您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HamburgerMenu.xaml 36 KiB

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ScrollViewer.xaml" />
  6. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Menu.xaml" />
  7. </ResourceDictionary.MergedDictionaries>
  8. <!-- HamburgerMenuItem -->
  9. <Style x:Key="RubyerHamburgerMenuItem" TargetType="{x:Type bpa:HamburgerMenuItem}">
  10. <Setter Property="Background" Value="Transparent" />
  11. <Setter Property="BorderBrush" Value="Transparent" />
  12. <Setter Property="BorderThickness" Value="0" />
  13. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  14. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  15. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  16. <Setter Property="Padding" Value="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  17. <Setter Property="SnapsToDevicePixels" Value="True" />
  18. <Setter Property="ToolTipService.Placement" Value="Right" />
  19. <Setter Property="ToolTipService.PlacementTarget" Value="{Binding RelativeSource={RelativeSource Self}}" />
  20. <Setter Property="ToolTipService.VerticalOffset" Value="3" />
  21. <Setter Property="ToolTipService.InitialShowDelay" Value="300" />
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="{x:Type bpa:HamburgerMenuItem}">
  25. <Grid x:Name="root">
  26. <Grid Margin="{Binding Path=(bpa:ItemsControlHelper.ItemMargin), RelativeSource={RelativeSource AncestorType=TabControl}}">
  27. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}"
  28. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ItemsControl}}"
  29. IsActive="{TemplateBinding IsSelected}"
  30. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=ItemsControl}}"
  31. ParentElement="{Binding ElementName=root}" />
  32. <bpa:Transition x:Name="littleBar"
  33. HorizontalAlignment="Left"
  34. IsShow="{TemplateBinding IsSelected}"
  35. Type="ZoomY"
  36. Visibility="{Binding IsShowLittleBar, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}, Converter={StaticResource BooleanToVisibleConverter}}">
  37. <Rectangle Width="3"
  38. Height="{Binding ActualHeight, ElementName=header}"
  39. Fill="{Binding Path=(bpa:ControlHelper.SelectedBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}" />
  40. </bpa:Transition>
  41. </Grid>
  42. <Border x:Name="Bd" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  43. <Grid>
  44. <Grid.ColumnDefinitions>
  45. <ColumnDefinition x:Name="iconClolumn" Width="{Binding CollapsedWidth, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}, Converter={StaticResource DoubleToGridLengthConverter}}" />
  46. <ColumnDefinition x:Name="headerColumn" Width="*" />
  47. </Grid.ColumnDefinitions>
  48. <bpa:Icon x:Name="icon"
  49. Focusable="False"
  50. IsHitTestVisible="False"
  51. Type="{TemplateBinding IconType}"
  52. Visibility="Collapsed" />
  53. <ContentPresenter x:Name="iconContent"
  54. Width="{Binding ActualHeight, ElementName=header}"
  55. Height="{Binding ActualHeight, ElementName=header}"
  56. HorizontalAlignment="Center"
  57. VerticalAlignment="Center"
  58. Content="{TemplateBinding Icon}"
  59. ContentSource="Icon"
  60. Focusable="False"
  61. IsHitTestVisible="False" />
  62. <ContentPresenter x:Name="header"
  63. Grid.Column="1"
  64. Margin="{TemplateBinding Padding}"
  65. HorizontalAlignment="Left"
  66. VerticalAlignment="Center"
  67. Content="{TemplateBinding Header}"
  68. ContentSource="Header"
  69. Focusable="False"
  70. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  71. </Grid>
  72. </Border>
  73. </Grid>
  74. <ControlTemplate.Triggers>
  75. <Trigger Property="IsEnabled" Value="False">
  76. <Setter TargetName="root" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  77. </Trigger>
  78. <Trigger Property="IsSelected" Value="True">
  79. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}" />
  80. </Trigger>
  81. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="True">
  82. <Setter TargetName="icon" Property="Visibility" Value="Visible" />
  83. <Setter TargetName="iconContent" Property="Visibility" Value="Collapsed" />
  84. </DataTrigger>
  85. <DataTrigger Binding="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" Value="False">
  86. <Setter Property="ToolTip" Value="{Binding Header, RelativeSource={RelativeSource Self}, Converter={StaticResource CloneConverter}}" />
  87. </DataTrigger>
  88. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" Value="Right">
  89. <Setter TargetName="littleBar" Property="HorizontalAlignment" Value="Right" />
  90. </DataTrigger>
  91. </ControlTemplate.Triggers>
  92. </ControlTemplate>
  93. </Setter.Value>
  94. </Setter>
  95. </Style>
  96. <!-- HamburgerMenuOptionsItem -->
  97. <Style x:Key="RubyerHamburgerMenuOptionsItem" TargetType="{x:Type bpa:HamburgerMenuOptionsItem}">
  98. <Setter Property="Height" Value="Auto" />
  99. <Setter Property="Cursor" Value="Arrow" />
  100. <Setter Property="HorizontalContentAlignment" Value="Left" />
  101. <Setter Property="VerticalContentAlignment" Value="Center" />
  102. <Setter Property="SnapsToDevicePixels" Value="True" />
  103. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  104. <Setter Property="ToolTip" Value="{Binding Header, RelativeSource={RelativeSource Self}, Converter={StaticResource CloneConverter}}" />
  105. <Setter Property="ToolTipService.Placement" Value="Right" />
  106. <Setter Property="ToolTipService.PlacementTarget" Value="{Binding RelativeSource={RelativeSource Self}}" />
  107. <Setter Property="ToolTipService.VerticalOffset" Value="3" />
  108. <Setter Property="ToolTipService.InitialShowDelay" Value="300" />
  109. <Setter Property="ToolTipService.IsEnabled" Value="False" />
  110. <Setter Property="Template">
  111. <Setter.Value>
  112. <ControlTemplate TargetType="{x:Type bpa:HamburgerMenuOptionsItem}">
  113. <Grid x:Name="root" Background="{TemplateBinding Background}">
  114. <bpa:ControlMask Margin="{Binding Path=(bpa:ItemsControlHelper.ItemMargin), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  115. Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  116. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  117. IsActive="{TemplateBinding IsPressed}"
  118. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" />
  119. <Border x:Name="Bd" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  120. <Grid>
  121. <Grid.ColumnDefinitions>
  122. <ColumnDefinition x:Name="iconClolumn" Width="{Binding CollapsedWidth, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}, Converter={StaticResource DoubleToGridLengthConverter}}" />
  123. <ColumnDefinition x:Name="headerColumn" Width="*" />
  124. </Grid.ColumnDefinitions>
  125. <bpa:Icon x:Name="icon"
  126. Focusable="False"
  127. IsHitTestVisible="False"
  128. Type="{TemplateBinding IconType}"
  129. Visibility="Collapsed" />
  130. <ContentPresenter x:Name="iconContent"
  131. Width="{Binding ActualHeight, ElementName=header}"
  132. Height="{Binding ActualHeight, ElementName=header}"
  133. HorizontalAlignment="Center"
  134. VerticalAlignment="Center"
  135. Content="{TemplateBinding Icon}"
  136. ContentSource="Icon"
  137. Focusable="False"
  138. IsHitTestVisible="False" />
  139. <bpa:Icon x:Name="checkIcon"
  140. Width="{Binding ActualHeight, ElementName=header}"
  141. Height="{Binding ActualHeight, ElementName=header}"
  142. HorizontalAlignment="Center"
  143. VerticalAlignment="Center"
  144. Focusable="False"
  145. Type="CheckFill"
  146. Visibility="Hidden" />
  147. <DockPanel Grid.Column="1" Margin="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}">
  148. <bpa:Icon x:Name="moreIcon"
  149. Margin="20 0 0 0"
  150. HorizontalAlignment="Center"
  151. VerticalAlignment="Center"
  152. DockPanel.Dock="Right"
  153. Type="ArrowRightSLine"
  154. Visibility="Hidden" />
  155. <ContentPresenter x:Name="header"
  156. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  157. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  158. ContentSource="Header"
  159. RecognizesAccessKey="True"
  160. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  161. </DockPanel>
  162. <Popup x:Name="Popup"
  163. AllowsTransparency="True"
  164. Focusable="False"
  165. IsOpen="{TemplateBinding IsSubmenuOpen}"
  166. Placement="Right"
  167. PopupAnimation="Fade">
  168. <Grid>
  169. <Border Margin="5"
  170. Padding="5"
  171. Background="{Binding PaneBackground, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  172. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  173. Effect="{DynamicResource AllDirectionEffect}" />
  174. <Border x:Name="SubmenuBorder"
  175. Margin="5"
  176. Padding="5"
  177. Background="{Binding PaneBackground, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  178. BorderBrush="{TemplateBinding BorderBrush}"
  179. BorderThickness="{TemplateBinding BorderThickness}"
  180. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  181. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  182. <ScrollViewer Style="{StaticResource MenuScrollViewer}" CanContentScroll="True">
  183. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
  184. </ScrollViewer>
  185. </Border>
  186. </Grid>
  187. </Popup>
  188. </Grid>
  189. </Border>
  190. </Grid>
  191. <ControlTemplate.Triggers>
  192. <Trigger Property="IsEnabled" Value="False">
  193. <Setter TargetName="root" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  194. </Trigger>
  195. <DataTrigger Binding="{Binding IconType, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource NotNullConverter}}" Value="True">
  196. <Setter TargetName="icon" Property="Visibility" Value="Visible" />
  197. <Setter TargetName="iconContent" Property="Visibility" Value="Collapsed" />
  198. </DataTrigger>
  199. <Trigger Property="Role" Value="SubmenuItem">
  200. <Setter TargetName="iconClolumn" Property="Width" Value="{Binding Path=(bpa:MenuHelper.IconWidth), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" />
  201. </Trigger>
  202. <Trigger Property="Role" Value="SubmenuHeader">
  203. <Setter TargetName="moreIcon" Property="Visibility" Value="Visible" />
  204. <Setter TargetName="iconClolumn" Property="Width" Value="{Binding Path=(bpa:MenuHelper.IconWidth), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" />
  205. </Trigger>
  206. <MultiTrigger>
  207. <MultiTrigger.Conditions>
  208. <Condition Property="Role" Value="SubmenuItem" />
  209. <Condition Property="IsChecked" Value="True" />
  210. </MultiTrigger.Conditions>
  211. <Setter TargetName="checkIcon" Property="Visibility" Value="Visible" />
  212. </MultiTrigger>
  213. <MultiTrigger>
  214. <MultiTrigger.Conditions>
  215. <Condition Property="Role" Value="SubmenuItem" />
  216. <Condition Property="IsCheckable" Value="True" />
  217. </MultiTrigger.Conditions>
  218. <Setter TargetName="icon" Property="Visibility" Value="Hidden" />
  219. </MultiTrigger>
  220. </ControlTemplate.Triggers>
  221. </ControlTemplate>
  222. </Setter.Value>
  223. </Setter>
  224. <Style.Triggers>
  225. <MultiDataTrigger>
  226. <MultiDataTrigger.Conditions>
  227. <Condition Binding="{Binding Role, RelativeSource={RelativeSource Self}}" Value="TopLevelHeader" />
  228. <Condition Binding="{Binding IsExpanded, FallbackValue=True, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" Value="False" />
  229. </MultiDataTrigger.Conditions>
  230. <Setter Property="ToolTipService.IsEnabled" Value="True" />
  231. </MultiDataTrigger>
  232. <MultiDataTrigger>
  233. <MultiDataTrigger.Conditions>
  234. <Condition Binding="{Binding Role, RelativeSource={RelativeSource Self}}" Value="TopLevelItem" />
  235. <Condition Binding="{Binding IsExpanded, FallbackValue=True, RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}" Value="False" />
  236. </MultiDataTrigger.Conditions>
  237. <Setter Property="ToolTipService.IsEnabled" Value="True" />
  238. </MultiDataTrigger>
  239. </Style.Triggers>
  240. </Style>
  241. <Style x:Key="RubyerHamburgerMenuOptions"
  242. BasedOn="{StaticResource RubyerMenu}"
  243. TargetType="bpa:HamburgerMenuOptions">
  244. <Setter Property="HorizontalAlignment" Value="Left" />
  245. <Setter Property="Template">
  246. <Setter.Value>
  247. <ControlTemplate TargetType="{x:Type bpa:HamburgerMenuOptions}">
  248. <Border x:Name="border"
  249. Background="Transparent"
  250. CornerRadius="{DynamicResource AllControlCornerRadius}">
  251. <StackPanel ClipToBounds="True" IsItemsHost="True" />
  252. </Border>
  253. </ControlTemplate>
  254. </Setter.Value>
  255. </Setter>
  256. </Style>
  257. <!-- HamburgerMenu -->
  258. <Style x:Key="RubyerHamburgerMenu" TargetType="{x:Type bpa:HamburgerMenu}">
  259. <Setter Property="Background" Value="Transparent" />
  260. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  261. <Setter Property="BorderThickness" Value="0" />
  262. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  263. <Setter Property="PaneBackground" Value="{DynamicResource DefaultBackground}" />
  264. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  265. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
  266. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  267. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  268. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  269. <Setter Property="SnapsToDevicePixels" Value="True" />
  270. <Setter Property="ItemContainerStyle" Value="{StaticResource RubyerHamburgerMenuItem}" />
  271. <Setter Property="bpa:ControlHelper.SelectedBrush" Value="{DynamicResource Primary}" />
  272. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Mask}" />
  273. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource DefaultForeground}" />
  274. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
  275. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="0.6" />
  276. <Setter Property="bpa:ItemsControlHelper.ItemMargin" Value="2 1" />
  277. <Setter Property="bpa:ItemsControlHelper.ItemPadding" Value="5 8" />
  278. <Setter Property="bpa:HeaderHelper.Background" Value="Transparent" />
  279. <Setter Property="bpa:HeaderHelper.Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource Self}}" />
  280. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  281. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  282. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  283. <Setter Property="bpa:HeaderHelper.Padding" Value="0 10" />
  284. <Setter Property="bpa:HeaderHelper.Margin" Value="0 0 0 0" />
  285. <Setter Property="CollapsedWidth" Value="40" />
  286. <Setter Property="ExpandedWidth" Value="200" />
  287. <Setter Property="IsExpanded" Value="True" />
  288. <Setter Property="IsShowHamburgerButton" Value="True" />
  289. <Setter Property="IsShowLittleBar" Value="True" />
  290. <Setter Property="OptionsItemContainerStyle" Value="{StaticResource RubyerHamburgerMenuOptionsItem}" />
  291. <Setter Property="TabStripPlacement" Value="Left" />
  292. <Setter Property="TransitionType" Value="Fade" />
  293. <Setter Property="TransitionDuration" Value="0:0:0.5" />
  294. <Setter Property="bpa:MenuHelper.IconWidth" Value="{Binding CollapsedWidth, RelativeSource={RelativeSource Self}}" />
  295. <Setter Property="Template">
  296. <Setter.Value>
  297. <ControlTemplate TargetType="{x:Type bpa:HamburgerMenu}">
  298. <Border Background="{TemplateBinding Background}"
  299. BorderBrush="{TemplateBinding BorderBrush}"
  300. BorderThickness="{TemplateBinding BorderThickness}"
  301. CornerRadius="{TemplateBinding CornerRadius}">
  302. <Grid x:Name="root">
  303. <Grid.ColumnDefinitions>
  304. <ColumnDefinition x:Name="menuColumn" Width="Auto" />
  305. <ColumnDefinition x:Name="contentColumn" Width="*" />
  306. </Grid.ColumnDefinitions>
  307. <Border x:Name="menu"
  308. Background="{TemplateBinding PaneBackground}"
  309. BorderBrush="{TemplateBinding BorderBrush}"
  310. BorderThickness="{TemplateBinding PaneBorderThickness}"
  311. CornerRadius="{TemplateBinding PaneBorderCornerRadius}"
  312. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  313. <bpa:Transition CollapsedSize="{TemplateBinding CollapsedWidth}"
  314. IsFade="False"
  315. IsShow="{TemplateBinding IsExpanded}"
  316. Type="CollapseLeft">
  317. <Grid Width="{TemplateBinding ExpandedWidth}">
  318. <Grid.RowDefinitions>
  319. <RowDefinition x:Name="menuRow" Height="Auto" />
  320. <RowDefinition x:Name="paneHeaderRow"
  321. Height="Auto"
  322. MinHeight="10" />
  323. <RowDefinition x:Name="itemsRow" Height="*" />
  324. <RowDefinition x:Name="optionsRow" Height="Auto" />
  325. <RowDefinition x:Name="paneFooterRow"
  326. Height="Auto"
  327. MinHeight="10" />
  328. </Grid.RowDefinitions>
  329. <Border x:Name="headerBorder"
  330. Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=bpa:Transition}}"
  331. Margin="{Binding Path=(bpa:HeaderHelper.Margin), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  332. HorizontalAlignment="Left"
  333. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}">
  334. <Button x:Name="PART_HamburgerButton"
  335. Style="{StaticResource TextButton}"
  336. Height="Auto"
  337. Padding="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  338. HorizontalContentAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  339. bpa:ControlHelper.CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  340. bpa:ControlHelper.FocusedBrush="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  341. bpa:ControlHelper.MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  342. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  343. ToolTipService.InitialShowDelay="100"
  344. ToolTipService.Placement="Right"
  345. ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource Self}}"
  346. ToolTipService.VerticalOffset="5">
  347. <Grid>
  348. <Grid.ColumnDefinitions>
  349. <ColumnDefinition Width="{TemplateBinding CollapsedWidth, Converter={StaticResource DoubleToGridLengthConverter}}" />
  350. <ColumnDefinition Width="*" />
  351. </Grid.ColumnDefinitions>
  352. <bpa:Icon Width="{Binding ActualHeight, ElementName=header}"
  353. Height="{Binding ActualHeight, ElementName=header}"
  354. HorizontalAlignment="Center"
  355. VerticalAlignment="Center"
  356. Type="MenuLine" />
  357. <TextBlock x:Name="header"
  358. Grid.Column="1"
  359. VerticalAlignment="Center"
  360. FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  361. FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  362. Text="{TemplateBinding Header}" />
  363. </Grid>
  364. </Button>
  365. </Border>
  366. <ContentPresenter Grid.Row="1"
  367. ContentSource="PaneHeader"
  368. Focusable="False"
  369. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  370. <Border x:Name="Bd"
  371. Grid.Row="2"
  372. Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=bpa:Transition}}"
  373. HorizontalAlignment="Left"
  374. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  375. <ScrollViewer x:Name="itemsScroll"
  376. Style="{StaticResource OnlyArrowScrollViewer}"
  377. bpa:ControlHelper.CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  378. bpa:ControlHelper.FocusedBrush="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=bpa:HamburgerMenu}}"
  379. bpa:ScrollViewerHelper.HorizontalDelta="150"
  380. bpa:ScrollViewerHelper.VerticalDelta="75"
  381. HorizontalScrollBarVisibility="Disabled"
  382. VerticalScrollBarVisibility="Auto">
  383. <TabPanel Panel.ZIndex="1"
  384. IsItemsHost="True"
  385. KeyboardNavigation.TabIndex="1" />
  386. </ScrollViewer>
  387. </Border>
  388. <bpa:HamburgerMenuOptions x:Name="PART_OptionsItemsControl"
  389. Style="{StaticResource RubyerHamburgerMenuOptions}"
  390. Grid.Row="3"
  391. Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=bpa:Transition}}"
  392. ItemContainerStyle="{TemplateBinding OptionsItemContainerStyle}"
  393. ItemTemplate="{TemplateBinding OptionsItemTemplate}"
  394. ItemTemplateSelector="{TemplateBinding OptionsItemTemplateSelector}"
  395. ItemsSource="{TemplateBinding OptionsItemsSource}"
  396. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  397. <ContentPresenter Grid.Row="4"
  398. ContentSource="PaneFooter"
  399. Focusable="False"
  400. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  401. </Grid>
  402. </bpa:Transition>
  403. </Border>
  404. <Border x:Name="contentPanel"
  405. Grid.Column="1"
  406. KeyboardNavigation.DirectionalNavigation="Contained"
  407. KeyboardNavigation.TabIndex="2"
  408. KeyboardNavigation.TabNavigation="Local">
  409. <bpa:Transition x:Name="PART_ContentTransition"
  410. Type="{TemplateBinding TransitionType}"
  411. Duration="{TemplateBinding TransitionDuration}">
  412. <ContentPresenter x:Name="PART_SelectedContentHost"
  413. Margin="{TemplateBinding Padding}"
  414. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  415. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  416. ContentSource="SelectedContent"
  417. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  418. </bpa:Transition>
  419. </Border>
  420. </Grid>
  421. </Border>
  422. <ControlTemplate.Triggers>
  423. <Trigger Property="IsEnabled" Value="False">
  424. <Setter TargetName="root" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  425. </Trigger>
  426. <MultiTrigger>
  427. <MultiTrigger.Conditions>
  428. <Condition Property="IsGrouping" Value="True" />
  429. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  430. </MultiTrigger.Conditions>
  431. <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
  432. </MultiTrigger>
  433. <Trigger Property="IsShowHamburgerButton" Value="False">
  434. <Setter TargetName="PART_HamburgerButton" Property="Visibility" Value="Collapsed" />
  435. </Trigger>
  436. <Trigger Property="IsExpanded" Value="False">
  437. <Setter TargetName="PART_HamburgerButton" Property="ToolTip" Value="{Binding Header, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  438. </Trigger>
  439. <Trigger Property="TabStripPlacement" Value="Right">
  440. <Setter TargetName="menuColumn" Property="Width" Value="*" />
  441. <Setter TargetName="contentColumn" Property="Width" Value="Auto" />
  442. <Setter TargetName="menu" Property="Grid.Column" Value="1" />
  443. <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
  444. </Trigger>
  445. <Trigger SourceName="itemsScroll" Property="ComputedVerticalScrollBarVisibility" Value="Visible">
  446. <Setter TargetName="headerBorder" Property="Margin" Value="0" />
  447. </Trigger>
  448. </ControlTemplate.Triggers>
  449. </ControlTemplate>
  450. </Setter.Value>
  451. </Setter>
  452. </Style>
  453. </ResourceDictionary>