Ribbon.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
  5. xmlns:system="clr-namespace:System;assembly=mscorlib">
  6. <Geometry x:Key="NailGeometry">M956.553 366.486L657.514 67.447c-7.888-7.888-18.204-11.772-28.52-11.772s-20.632 3.884-28.52 11.772L404.958 263.085c-14.806-1.7-29.734-2.428-44.662-2.428-88.837 0-177.675 29.249-250.614 87.746-18.69 14.927-20.268 42.962-3.277 59.953l220.516 220.517L65.506 890.046c-3.156 3.155-5.219 7.403-5.583 11.893l-4.126 45.147c-1.093 11.408 8.01 21.117 19.296 21.117 0.607 0 1.214 0 1.82-0.121l45.148-4.126c4.49-0.364 8.738-2.428 11.893-5.583L395.37 696.957l220.517 220.517c7.888 7.888 18.204 11.772 28.52 11.772 11.772 0 23.423-5.097 31.433-15.05 68.327-85.317 96.726-192.117 85.197-295.397l195.516-195.515c15.655-15.535 15.655-41.021 0-56.798zM699.142 557.268l-29.734 29.734 4.612 41.75c4.49 40.898 1.213 81.555-9.952 120.998-6.554 23.059-15.535 45.026-26.943 65.779L208.593 386.753c15.655-8.616 31.918-15.898 48.909-21.724 33.01-11.408 67.599-17.112 102.794-17.112 11.651 0 23.423 0.607 35.074 1.942l41.75 4.612 29.733-29.734 162.262-162.262 232.41 232.41-162.383 162.383z</Geometry>
  7. <Geometry x:Key="DialogBoxLauncherGeometry">M0,0 8,0 8,1 1,1 1,8 0,8 M 3.7,3 8,7.3 8,4 9,4 9,9 4,9 4,8 7.3,8 3,3.7</Geometry>
  8. <Style TargetType="hc:RibbonGroup">
  9. <Setter Property="Focusable" Value="False"/>
  10. <Setter Property="Height" Value="90"/>
  11. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  12. <Setter Property="Padding" Value="6 6 6 0"/>
  13. <Setter Property="ItemsPanel">
  14. <Setter.Value>
  15. <ItemsPanelTemplate>
  16. <WrapPanel/>
  17. </ItemsPanelTemplate>
  18. </Setter.Value>
  19. </Setter>
  20. <Setter Property="Template">
  21. <Setter.Value>
  22. <ControlTemplate TargetType="hc:RibbonGroup">
  23. <Grid>
  24. <Grid.RowDefinitions>
  25. <RowDefinition/>
  26. <RowDefinition Height="Auto"/>
  27. </Grid.RowDefinitions>
  28. <Grid.ColumnDefinitions>
  29. <ColumnDefinition/>
  30. <ColumnDefinition Width="Auto"/>
  31. <ColumnDefinition Width="Auto"/>
  32. </Grid.ColumnDefinitions>
  33. <ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}"/>
  34. <ContentPresenter Name="ContentPresenter" VerticalAlignment="Bottom" TextElement.Foreground="{DynamicResource SecondaryTextBrush}" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,2" ContentSource="Header" HorizontalAlignment="Center" Grid.Row="1"/>
  35. <Button hc:Poptip.Instance="{TemplateBinding LauncherPoptip}" Command="interactivity:ControlCommands.More" Visibility="{Binding ShowLauncherButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,2,0" Grid.Column="1" Width="16" Height="16" Grid.Row="1" HorizontalAlignment="Right" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="{DynamicResource SecondaryRegionBrush}">
  36. <Path Width="9" Height="9" Stretch="Uniform" Data="{StaticResource DialogBoxLauncherGeometry}" Fill="{DynamicResource SecondaryTextBrush}"/>
  37. </Button>
  38. <Border Visibility="{Binding ShowSplitter,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Width="1" Background="{TemplateBinding BorderBrush}"/>
  39. </Grid>
  40. <ControlTemplate.Triggers>
  41. <Trigger Property="ShowLauncherButton" Value="True">
  42. <Setter TargetName="ContentPresenter" Property="Margin" Value="20,0,20,2"/>
  43. </Trigger>
  44. </ControlTemplate.Triggers>
  45. </ControlTemplate>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. <Style TargetType="hc:RibbonTabHeader">
  50. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  51. <Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
  52. <Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}"/>
  53. <Setter Property="Background" Value="Transparent"/>
  54. <Setter Property="Margin" Value="0"/>
  55. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
  56. <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
  57. <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
  58. <Setter Property="VerticalContentAlignment" Value="Stretch"/>
  59. <Setter Property="Template">
  60. <Setter.Value>
  61. <ControlTemplate TargetType="hc:RibbonTabHeader">
  62. <Border Background="{TemplateBinding Background}">
  63. <hc:SimplePanel x:Name="templateRoot" SnapsToDevicePixels="true">
  64. <Border x:Name="BorderBottom" Visibility="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,2" Margin="12,0,12,2"/>
  65. <ContentPresenter x:Name="ContentPresenter" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  66. </hc:SimplePanel>
  67. </Border>
  68. </ControlTemplate>
  69. </Setter.Value>
  70. </Setter>
  71. <Style.Triggers>
  72. <Trigger Property="IsSelected" Value="True">
  73. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  74. </Trigger>
  75. </Style.Triggers>
  76. </Style>
  77. <Style TargetType="hc:RibbonTab">
  78. <Setter Property="Focusable" Value="False"/>
  79. <Setter Property="VerticalContentAlignment" Value="Center"/>
  80. <Setter Property="ItemsPanel">
  81. <Setter.Value>
  82. <ItemsPanelTemplate>
  83. <StackPanel Orientation="Horizontal"/>
  84. </ItemsPanelTemplate>
  85. </Setter.Value>
  86. </Setter>
  87. <Setter Property="Template">
  88. <Setter.Value>
  89. <ControlTemplate TargetType="hc:RibbonTab">
  90. <hc:SimplePanel Visibility="Collapsed" x:Name="PART_RootContainer">
  91. <Border x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,3" Background="{TemplateBinding Background}" Margin="0"/>
  92. <ScrollViewer hc:ScrollViewerAttach.Orientation="Horizontal" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
  93. <ItemsPresenter/>
  94. </ScrollViewer>
  95. </hc:SimplePanel>
  96. </ControlTemplate>
  97. </Setter.Value>
  98. </Setter>
  99. </Style>
  100. <Style TargetType="hc:Ribbon">
  101. <Setter Property="Focusable" Value="False"/>
  102. <Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
  103. <Setter Property="ContentHeight" Value="96"/>
  104. <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
  105. <Setter Property="BorderThickness" Value="0"/>
  106. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  107. <Setter Property="VerticalAlignment" Value="Top"/>
  108. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  109. <Setter Property="Padding" Value="10 0"/>
  110. <Setter Property="ItemsPanel">
  111. <Setter.Value>
  112. <ItemsPanelTemplate>
  113. <hc:SimplePanel/>
  114. </ItemsPanelTemplate>
  115. </Setter.Value>
  116. </Setter>
  117. <Setter Property="Template">
  118. <Setter.Value>
  119. <ControlTemplate TargetType="hc:Ribbon">
  120. <hc:ClipGrid x:Name="PART_RootPanel" IsClipEnabled="False">
  121. <Grid.RowDefinitions>
  122. <RowDefinition Height="Auto"/>
  123. <RowDefinition Height="Auto"/>
  124. </Grid.RowDefinitions>
  125. <Grid.ColumnDefinitions>
  126. <ColumnDefinition Width="Auto"/>
  127. <ColumnDefinition Width="Auto"/>
  128. <ColumnDefinition/>
  129. </Grid.ColumnDefinitions>
  130. <Grid x:Name="PART_ContentPanel" Grid.Row="1" Grid.ColumnSpan="3">
  131. <Grid.ColumnDefinitions>
  132. <ColumnDefinition/>
  133. <ColumnDefinition Width="Auto"/>
  134. </Grid.ColumnDefinitions>
  135. <Border Margin="{TemplateBinding Padding}" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource RegionBrush}">
  136. <Border.Effect>
  137. <DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="-90" Color="{StaticResource EffectShadowColor}" Opacity=".1" RenderingBias="Performance"/>
  138. </Border.Effect>
  139. </Border>
  140. <ItemsPresenter x:Name="PART_TabItemsPresenter" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.Column="0" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='1,0,0,0'}"/>
  141. <ToggleButton Command="interactivity:ControlCommands.Switch" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" Padding="2 0" Width="16" Height="20" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconElement.Geometry="{StaticResource UpGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource NailGeometry}"/>
  142. </Grid>
  143. <ContentPresenter Grid.Row="0" Grid.Column="0" ContentSource="PrefixContent"/>
  144. <hc:RibbonTabHeaderItemsControl Grid.Row="0" Grid.Column="1" Background="{TemplateBinding Background}" Focusable="False" x:Name="PART_TabHeaderItemsControl" Margin="0,0,0,2">
  145. <ItemsControl.ItemsPanel>
  146. <ItemsPanelTemplate>
  147. <StackPanel Margin="{Binding Padding, RelativeSource={RelativeSource AncestorType= hc:Ribbon}}" Orientation="Horizontal"/>
  148. </ItemsPanelTemplate>
  149. </ItemsControl.ItemsPanel>
  150. </hc:RibbonTabHeaderItemsControl>
  151. <ContentPresenter Grid.Row="0" Grid.Column="2" ContentSource="PostfixContent"/>
  152. </hc:ClipGrid>
  153. </ControlTemplate>
  154. </Setter.Value>
  155. </Setter>
  156. </Style>
  157. </ResourceDictionary>