JD2022-TU1/main/tools/framework/JD.PropertyEditor/View/PropertyEditorControl.xaml

204 lines
No EOL
14 KiB
XML

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:grids="http://schemas.actiprosoftware.com/winfx/xaml/grids"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"
xmlns:system="clr-namespace:System;assembly=mscorlib"
x:Class="JD.PropertyEditor.View.PropertyEditorControl"
mc:Ignorable="d"
xmlns:serialization="clr-namespace:JD.Serialization;assembly=JD.Serialization"
xmlns:drawing="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:converters="clr-namespace:JD.PropertyEditor.Converters"
xmlns:viewModel="clr-namespace:JD.PropertyEditor.ViewModel"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
xmlns:editors1="clr-namespace:JD.PropertyEditor.Editors"
d:DataContext="{d:DesignInstance viewModel:PropertyEditorViewModel}"
x:Name="PropertyEditorUserControl">
<UserControl.Resources>
<converters:ColorConverter x:Key="ColorConverter" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<shared:HorizontalListBox x:Name="CategorizedListBox" SelectedValuePath="Tag" SelectedIndex="0"
Margin="0 0 0 5"
VerticalAlignment="Center">
<ListBoxItem ToolTip="Categorized">
<ListBoxItem.Tag>
<system:Boolean>True</system:Boolean>
</ListBoxItem.Tag>
<Image Margin="0,1" Source="../Ressources/Categorize16.png" Width="16" Height="16" />
</ListBoxItem>
<ListBoxItem ToolTip="Sorted">
<ListBoxItem.Tag>
<system:Boolean>False</system:Boolean>
</ListBoxItem.Tag>
<Image Margin="0,1" Source="../Ressources/Sort16.png" Width="16" Height="16" />
</ListBoxItem>
</shared:HorizontalListBox>
<Border Grid.Row="0" Grid.Column="1" Margin="5 0 0 5" BorderThickness="1"
BorderBrush="{DynamicResource {x:Static themes:AssetResourceKeys.ButtonBorderNormalBrushKey}}">
<DockPanel>
<Canvas DockPanel.Dock="Right" x:Name="appbar_magnify" Width="16" Height="16"
Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" Margin="4 0" Background="Transparent">
<Path Width="16" Height="16" Canvas.Left="0" Canvas.Top="0" Stretch="Fill"
Fill="{DynamicResource {x:Static themes:AssetResourceKeys.ButtonForegroundDefaultedBrushKey}}"
Data="F1 M 42.5,22C 49.4036,22 55,27.5964 55,34.5C 55,41.4036 49.4036,47 42.5,47C 40.1356,47 37.9245,46.3435 36,45.2426L 26.9749,54.2678C 25.8033,55.4393 23.9038,55.4393 22.7322,54.2678C 21.5607,53.0962 21.5607,51.1967 22.7322,50.0251L 31.7971,40.961C 30.6565,39.0755 30,36.8644 30,34.5C 30,27.5964 35.5964,22 42.5,22 Z M 42.5,26C 37.8056,26 34,29.8056 34,34.5C 34,39.1944 37.8056,43 42.5,43C 47.1944,43 51,39.1944 51,34.5C 51,29.8056 47.1944,26 42.5,26 Z " />
</Canvas>
<editors:AutoCompleteBox x:Name="FilterTextBox" PlaceholderText="Search..." HasPopupButton="False"
BorderThickness="0" />
</DockPanel>
</Border>
<grids:PropertyGrid Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" x:Name="PropGrid" MinHeight="100"
DataObject="{Binding ElementName=PropertyEditorUserControl, Path=SelectedObject}"
DataObjects="{Binding ElementName=PropertyEditorUserControl, Path=SelectedObjects}"
DataFactory="{Binding ElementName=PropertyEditorUserControl, Path=DataFactory}"
CollectionPropertyDisplayMode="{Binding ElementName=PropertyEditorUserControl, Path=CollectionPropertyDisplayMode}"
ArePropertiesAutoExpanded="{Binding ElementName=PropertyEditorUserControl, Path=ArePropertiesAutoExpanded}"
SortComparer="{Binding ElementName=PropertyEditorUserControl, Path=SortComparer}"
ChildPropertyAdded="PropGrid_OnAddChildProperty"
ChildPropertyRemoved="PropGrid_OnRemoveChildProperty"
AreNestedCategoriesSupported="True"
IsFilterActive="True" IsSummaryVisible="True"
IsCategorized="{Binding SelectedValue, ElementName=CategorizedListBox}"
PropertyValueChanged="PropertyGrid_OnValueChanged"
SelectionChanged="PropGrid_SelectionChanged"
ItemExpanded="PropertyGrid_OnItemExpanded" ItemCollapsed="PropertyGrid_OnItemCollapsed">
<grids:PropertyGrid.DataFilter>
<shared:DataFilterGroup Operation="Or">
<grids:PropertyModelStringFilter Source="Name" Operation="Contains"
Value="{Binding Source={x:Reference FilterTextBox}, Path=Text}"
StringComparison="CurrentCultureIgnoreCase" />
<grids:PropertyModelStringFilter Source="ValueType" Operation="Contains"
Value="{Binding Source={x:Reference FilterTextBox}, Path=Text}"
StringComparison="CurrentCultureIgnoreCase" />
</shared:DataFilterGroup>
</grids:PropertyGrid.DataFilter>
<grids:PropertyGrid.PropertyEditors>
<grids:PropertyEditor PropertyType="serialization:Angle">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors1:CustomDoubleEditBox Value="{Binding Value.Degree, Mode=TwoWay}"
BorderThickness="0"
LostFocus="UIElement_OnLostFocus" HasPopup="True"
ValueChanged="DoubleEditBox_OnValueChanged"
PickerKind="Default" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:ExtendedStringPropertyEditor PropertyType="serialization:Path" x:Name="MyPathEditor" />
<grids:PropertyEditor PropertyType="drawing:Color">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:ColorEditBox BorderThickness="0" ValueChanged="DoubleEditBox_OnValueChanged"
Value="{Binding Value, Converter={StaticResource ColorConverter}}"
PreviewMouseDown="ColorEditBox_PreviewMouseDown" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="serialization:Vec2d">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="X" />
<editors1:CustomDoubleEditBox Grid.Column="1" Name="Box1" Value="{Binding Value.X}"
SpinnerVisibility="Visible"
ValueChanged="DoubleEditBox_OnValueChanged" />
<Label Content="Y" Grid.Column="2" />
<editors1:CustomDoubleEditBox Grid.Column="3" Name="Box2" Value="{Binding Value.Y}"
SpinnerVisibility="Visible"
ValueChanged="DoubleEditBox_OnValueChanged" />
</Grid>
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="serialization:Vec3d">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="X" />
<editors1:CustomDoubleEditBox Grid.Column="1" Value="{Binding Value.X}"
SpinnerVisibility="Visible"
ValueChanged="DoubleEditBox_OnValueChanged" />
<Label Content="Y" Grid.Column="2" />
<editors1:CustomDoubleEditBox Grid.Column="3" Value="{Binding Value.Y}"
SpinnerVisibility="Visible"
ValueChanged="DoubleEditBox_OnValueChanged" />
<Label Content="Z" Grid.Column="4" />
<editors1:CustomDoubleEditBox Grid.Column="5" Value="{Binding Value.Z}"
SpinnerVisibility="Visible"
ValueChanged="DoubleEditBox_OnValueChanged" />
</Grid>
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="system:Single">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors1:CustomSingleEditBox Value="{Binding Value, Mode=TwoWay}" BorderThickness="0"
LostFocus="UIElement_OnLostFocus" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="system:Double">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors1:CustomDoubleEditBox Value="{Binding Value, Mode=TwoWay}" BorderThickness="0"
LostFocus="UIElement_OnLostFocus" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="system:Int16">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:Int16EditBox Value="{Binding Value, Mode=TwoWay}" BorderThickness="0"
LostFocus="UIElement_OnLostFocus" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="system:Int32">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:Int32EditBox Value="{Binding Value, Mode=TwoWay}" BorderThickness="0"
LostFocus="UIElement_OnLostFocus" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
<grids:PropertyEditor PropertyType="system:Int64">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:Int64EditBox Value="{Binding Value, Mode=TwoWay}" BorderThickness="0"
LostFocus="UIElement_OnLostFocus" />
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
</grids:PropertyGrid.PropertyEditors>
</grids:PropertyGrid>
</Grid>
</UserControl>