PropertyGridBaseStyle.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:o="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
  4. xmlns:hc="clr-namespace:HandyControl.Controls"
  5. xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
  6. <DrawingBrush x:Key="SortByCategoryDrawingBrush" o:Freeze="True">
  7. <DrawingBrush.Drawing>
  8. <DrawingGroup o:Freeze="True">
  9. <GeometryDrawing o:Freeze="True" Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
  10. <GeometryDrawing o:Freeze="True" Brush="#FFF6F6F6" Geometry="F1M0.9999,-0.000199999999999534L0.9999,15.9998 10.9999,15.9998 10.9999,13.4148 11.9999,14.4138 15.9999,10.4138 15.9999,5.5858 14.0009,7.5858 14.0009,3.0008 10.9999,3.0008 10.9999,-0.000199999999999534z" />
  11. <GeometryDrawing o:Freeze="True" Brush="#FF424242" Geometry="F1M10,12.4141L10,15.0001 2,15.0001 2,1.0001 10,1.0001 10,3.0001 10,7.5861 8.414,6.0001 9,6.0001 9,3.0001 3,3.0001 3,6.0001 8,6.0001 8,7.0001 3,7.0001 3,10.0001 8,10.0001 8,10.4141 8.586,11.0001 3,11.0001 3,14.0001 9,14.0001 9,11.4141z" />
  12. <GeometryDrawing o:Freeze="True" Brush="#FFEFEFF0" Geometry="F1M8.5859,11L2.9999,11 2.9999,14 8.9999,14 8.9999,11.414z M7.9999,7L2.9999,7 2.9999,10 7.9999,10z M7.9999,6L2.9999,6 2.9999,3 8.9999,3 8.9999,6 8.4139,6 7.9999,5.586z" />
  13. <GeometryDrawing o:Freeze="True" Brush="#FF00529C" Geometry="F1M13,10L13,4 11,4 11,10 9,8 9,10 12,13 15,10 15,8z" />
  14. </DrawingGroup>
  15. </DrawingBrush.Drawing>
  16. </DrawingBrush>
  17. <DrawingBrush x:Key="SortByNameDrawingBrush" o:Freeze="True">
  18. <DrawingBrush.Drawing>
  19. <DrawingGroup o:Freeze="True">
  20. <GeometryDrawing o:Freeze="True" Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
  21. <GeometryDrawing o:Freeze="True" Brush="#FFF6F6F6" Geometry="F1M0,-0.000199999999999534L0,8.9998 1,8.9998 1,12.0008 2.586,12.0008 1,13.5858 1,15.9998 8,15.9998 8,13.0008 6.449,13.0008 8,12.0008 8,10.9998 12,14.9998 16,10.9998 16,4.9998 14,6.9998 14,3.0008 10,3.0008 10,6.9998 9,5.9998 9,-0.000199999999999534z" />
  22. <GeometryDrawing o:Freeze="True" Brush="#FF424242" Geometry="F1M7,7L5,2 4,2 2,7 3,7 3.399,6 5.601,6 6,7z M8,8L1,8 1,1 8,1z M4.5,3.25L5.2,5 3.8,5z M2,11L5,11 2,14 2,15 7,15 7,14 4.013,14 7,11.051 6.952,11 7,11 7,10 2,10z" />
  23. <GeometryDrawing o:Freeze="True" Brush="#FFEFEFF0" Geometry="F1M3.7998,5L4.4998,3.25 5.1998,5z M5.9998,7L6.9998,7 4.9998,2 3.9998,2 1.9998,7 2.9998,7 3.3998,6 5.6008,6z" />
  24. <GeometryDrawing o:Freeze="True" Brush="#FF00529C" Geometry="F1M15,8L15,10 12,13 9,10 9,8 11,10 11,4 13,4 13,10z" />
  25. </DrawingGroup>
  26. </DrawingBrush.Drawing>
  27. </DrawingBrush>
  28. <Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
  29. <Setter Property="Padding" Value="10"/>
  30. <Setter Property="Template">
  31. <Setter.Value>
  32. <ControlTemplate TargetType="ToolTip">
  33. <Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{DynamicResource RegionBrush}" Padding="{TemplateBinding Padding}" BorderThickness="1" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}">
  34. <Grid>
  35. <Grid.RowDefinitions>
  36. <RowDefinition Height="Auto"/>
  37. <RowDefinition Height="Auto"/>
  38. </Grid.RowDefinitions>
  39. <ContentPresenter x:Name="Presenter" Margin="0,0,0,10"/>
  40. <StackPanel Grid.Row="1" Orientation="Horizontal">
  41. <TextBlock FontWeight="Bold" Text="{Binding PropertyTypeName,RelativeSource={RelativeSource AncestorType=hc:PropertyItem}}"/>
  42. <TextBlock Text="{Binding PropertyName,RelativeSource={RelativeSource AncestorType=hc:PropertyItem}}" Margin="6,0,0,0"/>
  43. </StackPanel>
  44. </Grid>
  45. </Border>
  46. <ControlTemplate.Triggers>
  47. <Trigger Property="Content" Value="{x:Null}">
  48. <Setter TargetName="Presenter" Property="Visibility" Value="Collapsed"/>
  49. </Trigger>
  50. <Trigger Property="Content" Value="">
  51. <Setter TargetName="Presenter" Property="Visibility" Value="Collapsed"/>
  52. </Trigger>
  53. </ControlTemplate.Triggers>
  54. </ControlTemplate>
  55. </Setter.Value>
  56. </Setter>
  57. </Style>
  58. <Style x:Key="PropertyItemBaseStyle" TargetType="hc:PropertyItem">
  59. <Setter Property="Focusable" Value="False"/>
  60. <Setter Property="Margin" Value="0,0,0,6"/>
  61. <Setter Property="Template">
  62. <Setter.Value>
  63. <ControlTemplate TargetType="hc:PropertyItem">
  64. <GroupBox Style="{StaticResource GroupBoxOriginal}" hc:TitleElement.TitlePlacement="Left">
  65. <GroupBox.Header>
  66. <TextBlock Padding="0,0,10,0" Width="{Binding Path=(hc:TitleElement.TitleWidth).Value,RelativeSource={RelativeSource TemplatedParent}}" Text="{TemplateBinding DisplayName}" TextTrimming="CharacterEllipsis">
  67. <TextBlock.ToolTip>
  68. <ToolTip Style="{StaticResource PropertyItemToolTipBaseStyle}" Content="{TemplateBinding Description}"/>
  69. </TextBlock.ToolTip>
  70. </TextBlock>
  71. </GroupBox.Header>
  72. <ContentPresenter ContentSource="EditorElement"/>
  73. </GroupBox>
  74. </ControlTemplate>
  75. </Setter.Value>
  76. </Setter>
  77. </Style>
  78. <Style x:Key="PropertyItemsControlBaseStyle" TargetType="hc:PropertyItemsControl">
  79. <Setter Property="ItemContainerStyle" Value="{StaticResource PropertyItemBaseStyle}"/>
  80. <Setter Property="Focusable" Value="False"/>
  81. <Setter Property="Template">
  82. <Setter.Value>
  83. <ControlTemplate TargetType="hc:PropertyItemsControl">
  84. <hc:ScrollViewer Focusable="false" HorizontalScrollBarVisibility="Disabled">
  85. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  86. </hc:ScrollViewer>
  87. </ControlTemplate>
  88. </Setter.Value>
  89. </Setter>
  90. <Style.Triggers>
  91. <Trigger Property="IsGrouping" Value="False">
  92. <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
  93. </Trigger>
  94. </Style.Triggers>
  95. </Style>
  96. <Style x:Key="PropertyGroupItemBaseStyle" TargetType="GroupItem">
  97. <Setter Property="Margin" Value="0,0,0,6"/>
  98. <Setter Property="Padding" Value="10,6,6,0"/>
  99. <Setter Property="Template">
  100. <Setter.Value>
  101. <ControlTemplate TargetType="GroupItem">
  102. <Expander Header="{Binding Name}" IsExpanded="True">
  103. <Border BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}" CornerRadius="0,0,4,4">
  104. <ItemsPresenter Margin="{TemplateBinding Padding}"/>
  105. </Border>
  106. </Expander>
  107. </ControlTemplate>
  108. </Setter.Value>
  109. </Setter>
  110. </Style>
  111. <Style x:Key="PropertyGridBaseStyle" TargetType="hc:PropertyGrid">
  112. <Setter Property="MaxTitleWidth" Value="200"/>
  113. <Setter Property="MinTitleWidth" Value="120"/>
  114. <Setter Property="Focusable" Value="False"/>
  115. <Setter Property="Padding" Value="10"/>
  116. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  117. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  118. <Setter Property="Template">
  119. <Setter.Value>
  120. <ControlTemplate TargetType="hc:PropertyGrid">
  121. <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
  122. <Grid Margin="{TemplateBinding Padding}">
  123. <Grid.RowDefinitions>
  124. <RowDefinition Height="Auto"/>
  125. <RowDefinition/>
  126. </Grid.RowDefinitions>
  127. <DockPanel LastChildFill="True" Margin="0,0,0,6">
  128. <hc:ButtonGroup Margin="0,0,6,0" Visibility="{Binding ShowSortButton,RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonGroupSolid}">
  129. <RadioButton Command="interactivity:ControlCommands.SortByCategory" IsChecked="True">
  130. <Rectangle Width="16" Height="16" Fill="{StaticResource SortByCategoryDrawingBrush}"/>
  131. </RadioButton>
  132. <RadioButton Command="interactivity:ControlCommands.SortByName">
  133. <Rectangle Width="16" Height="16" Fill="{StaticResource SortByNameDrawingBrush}"/>
  134. </RadioButton>
  135. </hc:ButtonGroup>
  136. <hc:SearchBar x:Name="PART_SearchBar" IsRealTime="True" hc:InfoElement.ShowClearButton="True" Style="{StaticResource SearchBarPlus}"/>
  137. </DockPanel>
  138. <hc:PropertyItemsControl Grid.Row="1" x:Name="PART_ItemsControl" Style="{StaticResource PropertyItemsControlBaseStyle}">
  139. <hc:PropertyItemsControl.GroupStyle>
  140. <GroupStyle ContainerStyle="{StaticResource PropertyGroupItemBaseStyle}"/>
  141. </hc:PropertyItemsControl.GroupStyle>
  142. </hc:PropertyItemsControl>
  143. </Grid>
  144. </Border>
  145. </ControlTemplate>
  146. </Setter.Value>
  147. </Setter>
  148. </Style>
  149. </ResourceDictionary>