Skip to content

Commit

Permalink
状态栏顶部拖拽窗口 (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProJend authored Oct 10, 2024
1 parent 095ce79 commit 88c76a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/BiliLite.UWP/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Background="Transparent">

<Grid>
<Grid x:Name="CustomDragRegion" Width="{Binding ElementName=AvailableDragRegion, Path=Width}"/>
<winui:TabView
TabWidthMode="SizeToContent" Style="{ThemeResource DefaultTabViewStyle}"
x:Name="tabView"
Expand All @@ -35,15 +36,14 @@
<winui:TabViewItem.IconSource>
<winui:SymbolIconSource Symbol="Home" />
</winui:TabViewItem.IconSource>

</winui:TabViewItem>
</winui:TabView.TabItems>

<winui:TabView.TabStripHeader>
<Grid x:Name="ShellTitlebarInset" Background="Transparent" />
</winui:TabView.TabStripHeader>
<winui:TabView.TabStripFooter>
<Grid x:Name="CustomDragRegion" Background="Transparent" ></Grid>
<Grid x:Name="AvailableDragRegion" Background="Transparent" ></Grid>
</winui:TabView.TabStripFooter>
</winui:TabView>
<Border x:Name="MiniWindowsTitleBar" Visibility="Collapsed" Background="#00FFFFFF" Height="36" VerticalAlignment="Top"></Border>
Expand Down
12 changes: 6 additions & 6 deletions src/BiliLite.UWP/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public MainPage()
var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged;

Window.Current.SetTitleBar(CustomDragRegion);
Window.Current.SetTitleBar(AvailableDragRegion);

//处理页面跳转
MessageCenter.NavigateToPageEvent += NavigationHelper_NavigateToPageEvent;
Expand Down Expand Up @@ -86,10 +86,10 @@ private async void Current_Suspending(object sender, Windows.ApplicationModel.Su
var tabs = tabView.TabItems;
foreach (var tab in tabs)
{
if(!(tab is TabViewItem tabItem))continue;
if(!(tabItem.Content is MyFrame frame)) continue;
if (!(tab is TabViewItem tabItem)) continue;
if (!(tabItem.Content is MyFrame frame)) continue;
var page = frame.Content;
if(!(page is PlayPage playPage)) continue;
if (!(page is PlayPage playPage)) continue;
await playPage.ReportHistory();
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ private void MessageCenter_MiniWindowEvent(object sender, bool e)
else
{
MiniWindowsTitleBar.Visibility = Visibility.Collapsed;
Window.Current.SetTitleBar(CustomDragRegion);
Window.Current.SetTitleBar(AvailableDragRegion);
}
}

Expand Down Expand Up @@ -314,7 +314,7 @@ private void tabView_TabItemsChanged(TabView sender, IVectorChangedEventArgs arg

private void TabView_OnPreviewKeyDown(object sender, KeyRoutedEventArgs e)
{
if(e.Key == VirtualKey.Space && e.OriginalSource.GetType()!= typeof(TextBox))
if (e.Key == VirtualKey.Space && e.OriginalSource.GetType() != typeof(TextBox))
e.Handled = true;
}

Expand Down

0 comments on commit 88c76a5

Please sign in to comment.