371 lines
25 KiB
XML
371 lines
25 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:xtk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
|
|
<xtk:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
|
<DrawingBrush x:Key="CheckerBrush" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
|
|
<DrawingBrush.Drawing>
|
|
<DrawingGroup>
|
|
<GeometryDrawing Brush="White">
|
|
<GeometryDrawing.Geometry>
|
|
<RectangleGeometry Rect="0,0 100,100" />
|
|
</GeometryDrawing.Geometry>
|
|
</GeometryDrawing>
|
|
<GeometryDrawing Brush="LightGray">
|
|
<GeometryDrawing.Geometry>
|
|
<GeometryGroup>
|
|
<RectangleGeometry Rect="0,0 50,50" />
|
|
<RectangleGeometry Rect="50,50 50,50" />
|
|
</GeometryGroup>
|
|
</GeometryDrawing.Geometry>
|
|
</GeometryDrawing>
|
|
</DrawingGroup>
|
|
</DrawingBrush.Drawing>
|
|
</DrawingBrush>
|
|
<xtk:InverseBoolConverter x:Key="InverseBoolConverter" />
|
|
|
|
|
|
<!-- generic stuff-->
|
|
<Geometry x:Key="UpArrowGeometry">M 0 4 L 4 0 L 8 4 Z</Geometry>
|
|
<Geometry x:Key="DownArrowGeometry">M 0 0 L 4 4 L 8 0 Z</Geometry>
|
|
|
|
<DataTemplate x:Key="IncreaseGlyphNormalKey">
|
|
<Path Width="7" Height="4" Data="{StaticResource UpArrowGeometry}" Fill="{DynamicResource ControlGlyphColor}"
|
|
SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" />
|
|
</DataTemplate>
|
|
<DataTemplate x:Key="IncreaseGlyphDisabledKey">
|
|
<Path Width="7" Height="4" Data="{StaticResource UpArrowGeometry}" Fill="{DynamicResource ContainerBorder}"
|
|
SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" />
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="DecreaseGlyphNormalKey">
|
|
<Path Width="7" Height="4" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ControlGlyphColor}"
|
|
SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" />
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="DecreaseGlyphDisabledKey">
|
|
<Path Width="7" Height="4" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ContainerBorder}"
|
|
SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" />
|
|
</DataTemplate>
|
|
|
|
<xtk:SelectedObjectConverter x:Key="objectConverter" />
|
|
|
|
<ControlTemplate x:Key="ExpanderToggleButton" TargetType="{x:Type ToggleButton}">
|
|
<Grid>
|
|
<Rectangle Margin="0,0,0,0" x:Name="Rectangle" Fill="Transparent" />
|
|
<Path HorizontalAlignment="Center" x:Name="Up_Arrow" VerticalAlignment="Center" Fill="{DynamicResource ControlGlyphColor}" Data="M 0 0 L 4 4 L 8 0 Z" RenderTransformOrigin="0.5,0.5">
|
|
<Path.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform ScaleX="1" ScaleY="1" />
|
|
<SkewTransform AngleX="0" AngleY="0" />
|
|
<RotateTransform Angle="-90" />
|
|
<TranslateTransform X="0" Y="0" />
|
|
</TransformGroup>
|
|
</Path.RenderTransform>
|
|
</Path>
|
|
<Path Visibility="Collapsed" HorizontalAlignment="Center" x:Name="Down_Arrow" VerticalAlignment="Center" Fill="{DynamicResource ControlGlyphColor}" Data="M 0 4 L 4 0 L 8 4 Z" RenderTransformOrigin="0.5,0.5">
|
|
<Path.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform ScaleX="1" ScaleY="1" />
|
|
<SkewTransform AngleX="0" AngleY="0" />
|
|
<RotateTransform Angle="135" />
|
|
<TranslateTransform X="0" Y="0" />
|
|
</TransformGroup>
|
|
</Path.RenderTransform>
|
|
</Path>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="true">
|
|
<Setter Property="Visibility" Value="Visible" TargetName="Down_Arrow" />
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="Up_Arrow" />
|
|
<Setter Property="OpacityMask" TargetName="Down_Arrow" Value="#FF000000" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Fill" TargetName="Up_Arrow" Value="{DynamicResource ControlDefaultBorderBrush}" />
|
|
<Setter Property="Fill" TargetName="Down_Arrow" Value="{DynamicResource ControlDefaultBorderBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBrightDefaultBackground}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlDefaultForeground}" />
|
|
<Setter Property="IsExpanded" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Expander}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" x:Name="ContentRow" />
|
|
</Grid.RowDefinitions>
|
|
<Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="Transparent" Margin="0,0,0,2">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="20" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<ToggleButton Template="{StaticResource ExpanderToggleButton}" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" OverridesDefaultStyle="True" />
|
|
<ContentPresenter Grid.Column="1" Margin="1" RecognizesAccessKey="True" ContentSource="Header" TextElement.FontWeight="Bold" />
|
|
</Grid>
|
|
</Border>
|
|
<Border Visibility="Collapsed" Grid.Row="1" x:Name="ExpandSite" Background="{DynamicResource ControlDefaultBackground}">
|
|
<Border BorderThickness="0" Margin="0" Padding="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" />
|
|
</Border>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsExpanded" Value="True">
|
|
<Setter Property="Visibility" Value="Visible" TargetName="ExpandSite" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Background" Value="{DynamicResource ControlDisabledBackground}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlDisabledGlyphColor}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type xtk:PropertyGrid}">
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundColor}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ContainerBorder}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="SelectedObjectType"
|
|
Value="{Binding RelativeSource={RelativeSource Self}, Path=SelectedObject, Converter={StaticResource objectConverter}, ConverterParameter=Type}" />
|
|
<Setter Property="SelectedObjectTypeName"
|
|
Value="{Binding RelativeSource={RelativeSource Self}, Path=SelectedObject, Converter={StaticResource objectConverter}, ConverterParameter=TypeName}" />
|
|
<Setter Property="SelectedObjectName"
|
|
Value="{Binding RelativeSource={RelativeSource Self}, Path=SelectedObject, Converter={StaticResource objectConverter}, ConverterParameter=SelectedObjectName}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type xtk:PropertyGrid}">
|
|
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="0">
|
|
<Grid Margin="{TemplateBinding Padding}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition />
|
|
<RowDefinition Height="5" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="6,2,0,4"
|
|
Visibility="{Binding ShowTitle, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
<TextBlock Text="{TemplateBinding SelectedObjectTypeName}" FontWeight="Bold" />
|
|
<TextBlock Text="{TemplateBinding SelectedObjectName}" Margin="5,0,0,0" />
|
|
</StackPanel>
|
|
|
|
<Grid x:Name="toolsContainer" Grid.Row="1" Margin="4,0,4,4">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid x:Name="sortButtonContainer" Margin="4"
|
|
Visibility="{Binding ShowSortOptions, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
<StackPanel Orientation="Horizontal" Margin="1">
|
|
<RadioButton
|
|
IsChecked="{Binding IsCategorized, RelativeSource={RelativeSource TemplatedParent}}"
|
|
VerticalAlignment="Center"
|
|
ToolTip="Categorized">
|
|
<Image
|
|
Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/PropertyGrid/Images/Categorize16.png"
|
|
Width="16" Height="16" />
|
|
</RadioButton>
|
|
<RadioButton
|
|
IsChecked="{Binding IsCategorized, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
|
|
VerticalAlignment="Center"
|
|
ToolTip="Alphabetical">
|
|
<Image
|
|
Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/PropertyGrid/Images/SortAscending16.png"
|
|
Width="16" Height="16" />
|
|
</RadioButton>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<Border x:Name="searchBoxContainer" Grid.Column="1" Margin="4,4,0,4"
|
|
BorderBrush="{DynamicResource ContainerBorder}" BorderThickness="0"
|
|
Visibility="{Binding ShowSearchBox, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<xtk:WatermarkTextBox x:Name="_txtFilter"
|
|
Background="{DynamicResource ControlDarkerBackground}"
|
|
Text="{Binding Filter, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
|
|
Watermark="{TemplateBinding FilterWatermark}" />
|
|
|
|
<Button Grid.Column="1" Command="xtk:PropertyGridCommands.ClearFilter"
|
|
HorizontalAlignment="Left">
|
|
<Image
|
|
Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/PropertyGrid/Images/ClearFilter16.png"
|
|
Width="16" Height="16" />
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<Grid Grid.Row="2" Background="{DynamicResource ControlDefaultBackground}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<xtk:PropertyItemsControl x:Name="PART_PropertyItemsControl" IsTabStop="False"
|
|
Focusable="False"
|
|
ItemsSource="{Binding Properties, RelativeSource={RelativeSource TemplatedParent}}"
|
|
ItemContainerStyle="{Binding PropertyContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
|
|
Background="{DynamicResource ControlDefaultBackground}"
|
|
VerticalAlignment="Top">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
<ItemsControl.GroupStyle>
|
|
<GroupStyle>
|
|
<GroupStyle.ContainerStyle>
|
|
<Style TargetType="{x:Type GroupItem}">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<Border>
|
|
<Expander Header="{Binding Name}" Style="{StaticResource ExpanderStyle}">
|
|
<ItemsPresenter />
|
|
</Expander>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</GroupStyle.ContainerStyle>
|
|
</GroupStyle>
|
|
</ItemsControl.GroupStyle>
|
|
|
|
</xtk:PropertyItemsControl>
|
|
</ScrollViewer>
|
|
|
|
<Thumb x:Name="PART_DragThumb" HorizontalAlignment="Left" Width="5" Margin="6,0,0,0"
|
|
Cursor="SizeWE">
|
|
<Thumb.Template>
|
|
<ControlTemplate>
|
|
<Border Background="Transparent" />
|
|
</ControlTemplate>
|
|
</Thumb.Template>
|
|
</Thumb>
|
|
|
|
</Grid>
|
|
|
|
<GridSplitter Height="3" Grid.Row="3" HorizontalAlignment="Stretch"
|
|
Visibility="{Binding ShowSummary, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
<StackPanel Grid.Row="4" Margin="0,0,0,5"
|
|
Visibility="{Binding ShowSummary, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
<TextBlock Padding="2 2 2 0" FontWeight="Bold"
|
|
Text="{Binding SelectedPropertyItem.DisplayName, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
<TextBlock Padding="5 2 2 0" TextWrapping="WrapWithOverflow"
|
|
Text="{Binding SelectedPropertyItem.Description, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition SourceName="searchBoxContainer" Property="Visibility" Value="Collapsed" />
|
|
<Condition SourceName="sortButtonContainer" Property="Visibility" Value="Collapsed" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="toolsContainer" Property="Visibility" Value="Collapsed" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Background" Value="{DynamicResource ControlDefaultBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlDisabledBorderBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<xtk:ExpandableObjectMarginConverter x:Key="ExpandableObjectMarginConverter" />
|
|
|
|
<Style x:Key="PropertyExpanderStyle" TargetType="{x:Type Expander}">
|
|
<Setter Property="Padding" Value="0 0 0 0" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Expander}">
|
|
<Grid>
|
|
<Border Visibility="Collapsed" x:Name="ExpandSite" Padding="0 0 0 0">
|
|
<Border BorderThickness="0" Margin="0" Padding="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" />
|
|
</Border>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsExpanded" Value="True">
|
|
<Setter Property="Visibility" Value="Visible" TargetName="ExpandSite" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type xtk:PropertyItem}">
|
|
<Setter Property="Background" Value="{DynamicResource ControlDefaultBackground}" />
|
|
<!-- Set the margin at 1 pixel bottom to let the horizontal "line" effect appear. -->
|
|
<Setter Property="Margin" Value="0,0,0,1" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type xtk:PropertyItem}">
|
|
<Border ContextMenu="{Binding AdvancedOptionsMenu, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=xtk:PropertyGrid}}" ContextMenuService.Placement="Bottom">
|
|
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<ToggleButton x:Name="_expandableButton" Grid.Column="0" Template="{StaticResource ExpanderToggleButton}" OverridesDefaultStyle="True" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
|
|
<Border Grid.Row="0" x:Name="PART_Editor" Grid.Column="1" Background="{TemplateBinding Background}" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<ContentControl x:Name="PART_ValueContainer" Content="{TemplateBinding Editor}" Focusable="False" IsTabStop="False" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" IsEnabled="{Binding IsReadOnly, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=xtk:PropertyGrid}, Converter={StaticResource InverseBoolConverter}}">
|
|
</ContentControl>
|
|
</Border>
|
|
|
|
<Expander Grid.Column="0" x:Name="_propertyExpander" Grid.ColumnSpan="2" Grid.Row="1" IsExpanded="{TemplateBinding IsExpanded}" Style="{StaticResource PropertyExpanderStyle}" IsEnabled="True">
|
|
<xtk:PropertyItemsControl x:Name="PART_PropertyItemsControl" IsTabStop="False" Focusable="False" ItemsSource="{Binding Properties, RelativeSource={RelativeSource TemplatedParent}}" ItemContainerStyle="{Binding PropertyContainerStyle, RelativeSource={RelativeSource TemplatedParent}}" >
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
</xtk:PropertyItemsControl>
|
|
</Expander>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" TargetName="PART_ValueContainer" Value="{DynamicResource ControlDisabledGlyphColor}" />
|
|
</Trigger>
|
|
<Trigger Property="Validation.HasError" Value="true">
|
|
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
|
|
</Trigger>
|
|
<Trigger Property="Visibility" Value="Visible" SourceName="_expandableButton">
|
|
<Setter Property="Focusable" Value="False" />
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |