FrameBaseStyle.xaml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="MenuItem4FrameStyle" BasedOn="{StaticResource MenuItemBaseStyle}" TargetType="MenuItem">
  5. <Setter Property="Header" Value="{Binding (JournalEntry.Name)}"/>
  6. <Setter Property="Command" Value="NavigationCommands.NavigateJournal"/>
  7. <Setter Property="CommandTarget" Value="{Binding TemplatedParent, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
  8. <Setter Property="CommandParameter" Value="{Binding RelativeSource={RelativeSource Self}}"/>
  9. </Style>
  10. <ControlTemplate x:Key="FrameWithNavigationUIStyle" TargetType="Frame">
  11. <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  12. <DockPanel LastChildFill="True">
  13. <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" DockPanel.Dock="Top" BorderThickness="0,0,0,1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource DarkDefaultBrush}">
  14. <hc:ButtonGroup x:Name="NavChrome" Width="90" Margin="10,6" HorizontalAlignment="Left">
  15. <Button Padding="6" hc:IconElement.Geometry="{StaticResource LeftGeometry}" Command="NavigationCommands.BrowseBack">
  16. <Button.ContextMenu>
  17. <ContextMenu x:Name="BackNavMenu" ItemContainerStyle="{StaticResource MenuItem4FrameStyle}" ItemsSource="{Binding Path=(NavigationWindow.BackStack), RelativeSource={RelativeSource TemplatedParent}}"/>
  18. </Button.ContextMenu>
  19. </Button>
  20. <Button Padding="6" hc:IconElement.Geometry="{StaticResource RightGeometry}" Command="NavigationCommands.BrowseForward">
  21. <Button.ContextMenu>
  22. <ContextMenu x:Name="ForwardNavMenu" ItemContainerStyle="{StaticResource MenuItem4FrameStyle}" ItemsSource="{Binding Path=(NavigationWindow.ForwardStack), RelativeSource={RelativeSource TemplatedParent}}"/>
  23. </Button.ContextMenu>
  24. </Button>
  25. <Button Padding="6" hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" Command="NavigationCommands.Refresh"/>
  26. </hc:ButtonGroup>
  27. </Border>
  28. <ContentPresenter SnapsToDevicePixels="True" x:Name="PART_NavWinCP" ClipToBounds="true"/>
  29. </DockPanel>
  30. </Border>
  31. </ControlTemplate>
  32. <Style x:Key="FrameBaseStyle" TargetType="Frame">
  33. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  34. <Setter Property="BorderThickness" Value="1"/>
  35. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  36. <Setter Property="Template">
  37. <Setter.Value>
  38. <ControlTemplate TargetType="Frame">
  39. <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  40. <ContentPresenter SnapsToDevicePixels="True" x:Name="PART_FrameCP"/>
  41. </Border>
  42. </ControlTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. <Style.Triggers>
  46. <Trigger Property="NavigationUIVisibility" Value="Visible">
  47. <Setter Property="Template" Value="{StaticResource FrameWithNavigationUIStyle}"/>
  48. </Trigger>
  49. <MultiTrigger>
  50. <MultiTrigger.Conditions>
  51. <Condition Property="JournalOwnership" Value="OwnsJournal"/>
  52. <Condition Property="NavigationUIVisibility" Value="Automatic"/>
  53. </MultiTrigger.Conditions>
  54. <Setter Property="Template" Value="{StaticResource FrameWithNavigationUIStyle}"/>
  55. </MultiTrigger>
  56. </Style.Triggers>
  57. </Style>
  58. </ResourceDictionary>