Repository navigation
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
134 lines (124 loc) · 7.47 KB
/
Copy pathMainWindow.xaml
File metadata and controls
134 lines (124 loc) · 7.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="Reframe.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Title="Reframe">
<!-- 真两行布局(图吧工具箱式),取代旧的"标题栏覆盖条浮在 NavigationView 之上"方案。
旧方案在侧栏收起时结构性撞车:内容区左移,页面大标题钻进浮在顶上的标题栏带与"Reframe"重叠。
现在 Row0 是实体标题栏占据真实高度,Row1 才是 NavigationView —— 页面内容永远从 Row1 起,
无论侧栏展开/收起/窗口多窄都不可能钻到标题栏底下。
ExtendsContentIntoTitleBar=true + SetTitleBar(AppTitleDragRegion) 在代码后置里设。 -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="56"/>
<!-- Row1:更新提示条。Auto 高度 + 默认 IsOpen=False,收起时不占任何空间;
展开时把 NavigationView 整体下推,不浮在内容上,不遮挡任何东西。 -->
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Row 0:实体标题栏。三列 Auto(自绘汉堡) / Auto(图标+标题) / *(拖拽区,延伸到右侧系统按钮处)。
自绘汉堡必须在拖拽区(SetTitleBar 元素)之外 —— SetTitleBar 元素内的交互控件收不到输入。
图标+标题是非交互元素,放哪都不挡;此处放拖拽区内,随手可拖更顺手。 -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 自绘汉堡:替代 NavigationView 自带 PaneToggleButton(已隐藏)。
尺寸/观感对齐原生:约 40 宽 36 高、透明底、hover 有底色(借 SubtleFillColorSecondaryBrush /
pressed 用 Tertiary,与系统 Subtle 按钮一致)、垂直居中。FontIcon E700 = GlobalNavigationButton。
在拖拽区之外,故 Click 能正常收到。 -->
<!-- AutomationProperties.Name / ToolTip set in code-behind via Loc.T (localized);
attached-property x:Uid in resw is brittle in MRT Core. See MainWindow.xaml.cs. -->
<Button x:Name="PaneToggleButton"
Grid.Column="0"
Width="40" Height="36"
VerticalAlignment="Center"
Margin="4,0,0,0"
Padding="0"
Background="Transparent"
BorderThickness="0"
Click="PaneToggle_Click">
<FontIcon Glyph="" FontSize="16"/>
</Button>
<!-- 拖拽区:占满第二列(* 列自然延伸到右侧,系统按钮区由系统自己接管)。
SetTitleBar 的目标 —— 拖动 / 双击最大化由系统接管。Background 透明 → 透出云母。
图标与文本是非交互元素,不挡拖拽。 -->
<Grid x:Name="AppTitleDragRegion"
Grid.Column="1"
Background="Transparent">
<StackPanel Orientation="Horizontal" Spacing="10"
VerticalAlignment="Center"
Margin="4,0,0,0">
<Image x:Name="TitleBarIcon" Width="20" Height="20"
VerticalAlignment="Center"/>
<TextBlock x:Name="AppTitleText" Text="Reframe"
Style="{ThemeResource BodyStrongTextBlockStyle}"
VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Grid>
<!-- Row 1:发现新版本时的通知条(启动检查命中才展开)。文案与按钮内容在代码后置经 Loc.T 设
(含版本号,属运行时拼装串);「查看」跳设置页,右侧 X 可关闭。同一版本一个会话只提示一次。
窗口若正缩在托盘,这里保持展开状态,等用户下次打开主窗口时自然看到——不强弹窗口。 -->
<InfoBar x:Name="UpdateBar"
Grid.Row="1"
IsOpen="False"
IsClosable="True"
Severity="Informational"
Margin="12,0,12,4">
<InfoBar.ActionButton>
<Button x:Name="UpdateBarViewButton" Click="UpdateBarView_Click"/>
</InfoBar.ActionButton>
</InfoBar>
<!-- Row 2:NavigationView。自带汉堡隐藏(IsPaneToggleButtonVisible=False),改由 Row0 自绘汉堡驱动。
已无浮层撞车问题,故 IsTitleBarAutoPaddingEnabled 与 NavigationViewButtonHolderGridMargin 资源全部清掉。
OpenPaneLength=210、行高 48、图标 20px 保留。 -->
<muxc:NavigationView
x:Name="Nav"
Grid.Row="2"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
PaneDisplayMode="Left"
IsPaneToggleButtonVisible="False"
OpenPaneLength="210"
SelectionChanged="Nav_SelectionChanged">
<!-- 导航项行高:默认 40 偏挤,提到 48 让图标(已放大到 20px)与文字更舒展,
对标成熟应用(图吧工具箱)的标准 NavigationView 观感(经 44/48 截图比对,48 更贴近其舒展度)。
OpenPaneLength 同步 200→210 平衡更大的行高。 -->
<muxc:NavigationView.Resources>
<x:Double x:Key="NavigationViewItemOnLeftMinHeight">48</x:Double>
</muxc:NavigationView.Resources>
<!-- 导航项文案经 x:Uid 从 Strings\<lang>\MainWindow.resw 取(键 NavXxx.Content)。
Tag 是稳定的路由键,不本地化。详见 docs\dev\I18N.md。 -->
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem x:Uid="/MainWindow/NavDashboard" Tag="dashboard">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="" FontSize="20"/>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="/MainWindow/NavProfiles" Tag="profiles">
<muxc:NavigationViewItem.Icon>
<!-- 手柄图标(E7FC):配置文件本质是"每个游戏一份",比旧的旗帜图标更直观 -->
<FontIcon Glyph="" FontSize="20"/>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="/MainWindow/NavLayouts" Tag="layouts">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="" FontSize="20"/>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.MenuItems>
<muxc:NavigationView.FooterMenuItems>
<muxc:NavigationViewItem x:Uid="/MainWindow/NavSettings" Tag="settings">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="" FontSize="20"/>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.FooterMenuItems>
<Frame x:Name="ContentFrame"/>
</muxc:NavigationView>
</Grid>
</Window>