Sic.Framework-Nanjing-Baishi/Sicentury.Core/UserControls/ParameterNodeTreeViewContro...

308 lines
18 KiB
XML

<UserControl
x:Class="Sicentury.Core.UserControls.ParameterNodeTreeViewControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:attachedProperties="clr-namespace:Sicentury.Core.AttachedProperties"
xmlns:converters="clr-namespace:Sicentury.Core.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<converters:ParameterNodeTreeViewVisibilityMultiBindingConverter x:Key="NodeVisibilityConverter" />
<Style x:Key="styleTitle" TargetType="TextBlock">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="Black" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5,0" />
</Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Setter Property="Margin" Value="1,0,0,0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Width" Value="30" />
<Setter Property="Height" Value="30" />
</Style>
<Style TargetType="Path">
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground, Mode=OneTime}" />
<Setter Property="Stretch" Value="Uniform" />
<Setter Property="Width" Value="16" />
<Setter Property="Height" Value="16" />
</Style>
<ResourceDictionary x:Key="whatever">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MECF.Framework.UI.Client;component/Themes/SeaBlue/Button.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Group management Group list -->
<Grid
Grid.Row="1"
Margin="0,5,0,0"
Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=VisibilityTopTools}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource styleTitle}" Text="Group" />
<ComboBox
x:Name="cbxPresetList"
Grid.Column="1"
HorizontalAlignment="Stretch"
SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=SelectedGroup}"
SelectionChanged="CbxPresetList_OnSelectionChanged" />
<!-- Group management toolbar -->
<StackPanel
Grid.Column="2"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnNewGroup"
Click="BtnNewGroup_OnClick"
ToolTip="New Group">
<Button.Content>
<Path Data="M405 213v43h-64v64h-42v-64h-64v-43h64v-64h42v64h64zM427 384c24 0 42 -19 42 -43v-213c0 -24 -18 -43 -42 -43h-342c-24 0 -42 19 -42 43v256c0 24 18 43 42 43h128l43 -43h171z">
<Path.LayoutTransform>
<ScaleTransform ScaleY="-1" />
</Path.LayoutTransform>
</Path>
</Button.Content>
</Button>
<Button
x:Name="btnSave"
Click="BtnSave_OnClick"
ToolTip="Save">
<Button.Content>
<Path Data="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" />
</Button.Content>
</Button>
<Button
x:Name="btnSaveAs"
Click="BtnSaveAs_OnClick"
ToolTip="Save As">
<Button.Content>
<Path Data="M17,7V3H7V7H17M14,17A3,3 0 0,0 17,14A3,3 0 0,0 14,11A3,3 0 0,0 11,14A3,3 0 0,0 14,17M19,1L23,5V17A2,2 0 0,1 21,19H7C5.89,19 5,18.1 5,17V3A2,2 0 0,1 7,1H19M1,7H3V21H17V23H3A2,2 0 0,1 1,21V7Z" />
</Button.Content>
</Button>
<Button
x:Name="btnDelete"
Click="BtnDelete_OnClick"
ToolTip="Delete">
<Button.Content>
<Path Data="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" />
</Button.Content>
</Button>
<Button
x:Name="btnRefreshPresetList"
Click="BtnRefreshPresetList_OnClick"
ToolTip="Refresh">
<Button.Content>
<Path Data=" M536.3 250.4H750V464C749.7 511.3 722 522.7 688.6 489.2L640.5 441C598.3 474.1 546.5 492.2 492 492.2C427.4 492.2 366.6 467 321 421.3C275.2 375.8 250 315 250 250.4C250 185.7 275.2 124.9 320.9 79.3C366.6 33.5 427.3 8.3 492 8.3C556.5 8.3 617.3 33.5 663 79.3C675.4 91.7 686.3 105.2 695.5 119.5C710 142 703.5 172 681 186.4C658.5 200.8 628.5 194.3 614.1 171.8C608.6 163.2 602 155.1 594.6 147.6C567.2 120.2 530.7 105.1 492 105.1C453.2 105.1 416.8 120.2 389.3 147.6C361.9 175 346.8 211.5 346.8 250.3C346.8 289.1 361.9 325.5 389.3 352.9C416.8 380.3 453.2 395.4 492 395.4C520.6 395.4 548 387 571.5 371.6L511.2 311.1C477.7 277.7 489.1 250.4 536.3 250.4z" />
</Button.Content>
</Button>
</StackPanel>
</Grid>
<TreeView
x:Name="ParameterTreeView"
Grid.Row="2"
Margin="0,5,0,0"
ItemsSource="{Binding Path=TreeRoot.ChildNodes, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=TwoWay}"
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
VirtualizingStackPanel.CacheLengthUnit="Item"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.ScrollUnit="Pixel"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="TreeView.SelectedItemChanged">
<cal:ActionMessage MethodName="OnTreeSelectedChanged">
<cal:Parameter Value="{Binding ElementName=ParameterTreeView,Path=SelectedItem}"></cal:Parameter>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>-->
<TreeView.ItemContainerStyle>
<Style BasedOn="{StaticResource ResourceKey={x:Type TreeViewItem}}" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}" />
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding Converter="{StaticResource NodeVisibilityConverter}">
<Binding Path="IsMatch" />
<Binding Path="Visibility" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, Delay=10}">
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="ParameterCheck">
<micro:Parameter Value="{Binding }"/>
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>-->
</CheckBox>
<TextBlock
attachedProperties:TextBlockHighlighter.ForeColor="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}"
attachedProperties:TextBlockHighlighter.HighlightColor="Yellow"
attachedProperties:TextBlockHighlighter.Selection="{Binding Path=FilterKeyWord, Mode=OneWay}"
Text="{Binding Name}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<!-- Tree View Function Buttons -->
<Grid Grid.Row="3">
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,5,0" />
</Style>
</StackPanel.Resources>
<Path
Width="16"
Height="16"
Margin="5,0,10,0"
VerticalAlignment="Center"
Data="M1024 320v256h-704v-64h-128v192h576v256h-768v-256h128v-640h192v-128h704v256h-704v-64h-128v320h128v-128z"
Fill="Black"
ToolTip="Selection" />
<TextBlock Text="{Binding TreeRoot.SelectedTerminalCount, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" ToolTip="Selected Nodes" />
<TextBlock Text="/" />
<TextBlock Text="{Binding TreeRoot.TotalTerminalCount, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" ToolTip="Total Nodes" />
</StackPanel>
<StackPanel
Margin="0,5,0,0"
HorizontalAlignment="Right"
Orientation=" Horizontal">
<Button
x:Name="btnExcludeNode"
Click="BtnExcludeNode_OnClick"
ToolTip="Edit Exclude Nodes List"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=VisibilityExcludeNodesButton}">
<Button.Content>
<Path Data="M117.65 187.5H82.35L76.3 157.2125L50.6 174.3375L25.65 149.4L42.775 123.7L12.5 117.65V82.35L42.7875 76.3L25.6625 50.6L50.6 25.65L76.3 42.775L82.35 12.5H108.3875A56.575 56.575 0 0 0 96.925 25.0625H92.65L89.05 43.075A55.9125 55.9125 0 0 0 88.2125 47.25L86.7625 54.5375L77.2125 58.4875L52.2125 41.8125L41.8125 52.2L58.5 77.2125L54.55 86.7625L25.075 92.65V107.35L54.55 113.2375L58.5 122.7875L41.825 147.7875L52.2125 158.1875L77.2125 141.5L86.7625 145.45L92.65 174.925H107.35L113.2375 145.45L122.7875 141.5L147.7875 158.175L158.1875 147.7875L141.5125 122.775L145.4625 113.225L152.7375 111.775C154.15 111.55 155.55 111.275 156.925 110.9375L174.9375 107.3375V103.0625C179.6875000000001 99.8875 183.9250000000001 96.025 187.5000000000001 91.6V117.65L157.225 123.7L174.3500000000001 149.4L149.4 174.35L123.7000000000001 157.225L117.65 187.5zM100 125A25 25 0 0 0 123.4375 108.725A55.75 55.75 0 0 1 112.1875 102.8125A12.5 12.5 0 1 1 97.1875 87.8125A55.75 55.75 0 0 1 91.275 76.5625A25 25 0 0 0 100 125zM116 90.0625A43.75 43.75 0 1 0 171.5 22.4375A43.75 43.75 0 0 0 116 90.0625zM112.5 62.5V50H175V62.5H112.5z">
<Path.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1" />
</TransformGroup>
</Path.LayoutTransform>
</Path>
</Button.Content>
</Button>
<Button
x:Name="btnShowAll"
Click="BtnShowAll_OnClick"
ToolTip="Show All">
<Button.Content>
<Path Data="M512 746.667c-325.675 0-423.552-282.325-424.448-285.184l-4.523-13.483 4.48-13.483c0.939-2.859 98.816-285.184 424.491-285.184s423.552 282.325 424.448 285.184l4.523 13.483-4.48 13.483c-0.939 2.859-98.816 285.184-424.491 285.184zM512 277.333c-94.123 0-170.667 76.544-170.667 170.667s76.544 170.667 170.667 170.667 170.667-76.544 170.667-170.667-76.544-170.667-170.667-170.667zM512 533.333c-46.251 0-85.333-39.083-85.333-85.333s39.083-85.333 85.333-85.333 85.333 39.083 85.333 85.333-39.083 85.333-85.333 85.333z" />
</Button.Content>
</Button>
<Button
x:Name="btnShowSelectedOnly"
Click="BtnShowSelectedOnly_OnClick"
ToolTip="Show Selected Only">
<Button.Content>
<Path Data="M256,352c53,0,96-43,96-96s-43-96-96-96s-96,43-96,96S203,352,256,352z M256,432c-97,0-176-80-176-176c0-95,75-176,176-176c96,0,176,74,176,176C432,354,354,432,256,432z M256,480c121,0,224-97,224-224c0-121-97-224-224-224C135,32,32,129,32,256C32,377,129,480,256,480z">
<Path.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1" />
</TransformGroup>
</Path.LayoutTransform>
</Path>
</Button.Content>
</Button>
<Button
x:Name="btnCollapseAll"
Click="BtnCollapseAll_OnClick"
ToolTip="Collapse All">
<Button.Content>
<Path Data="M 19,29L 47,29L 47,57L 19,57L 19,29 Z M 43,33L 23,33.0001L 23,53L 43,53L 43,33 Z M 39,41L 39,45L 27,45L 27,41L 39,41 Z M 24,24L 51.9999,24.0001L 51.9999,52L 48.9999,52.0001L 48.9999,27.0001L 24,27.0001L 24,24 Z M 54,47L 53.9999,22.0001L 29,22L 29,19L 57,19L 57,47L 54,47 Z " />
</Button.Content>
</Button>
<Button
x:Name="btnExpandAll"
Click="BtnExpandAll_OnClick"
ToolTip="Expand All">
<Button.Content>
<Path Data="M 19,29L 47,29L 47,57L 19,57L 19,29 Z M 43,33L 23,33.0001L 23,53L 43,53L 43,33 Z M 39,41L 39,45L 35,45L 35,49L 31,49L 31,45L 27,45L 27,41L 31,41L 31,37L 35,37L 35,41L 39,41 Z M 24,24L 51.9999,24.0001L 51.9999,52L 48.9999,52.0001L 48.9999,27.0001L 24,27.0001L 24,24 Z M 53.9999,47L 53.9999,22.0001L 29,22L 29,19L 56.9999,19.0001L 57,47L 53.9999,47 Z " />
</Button.Content>
</Button>
</StackPanel>
</Grid>
<!-- Filter Input Box -->
<Grid Grid.Row="4" Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Filter Toolbar -->
<TextBlock Style="{StaticResource styleTitle}" Text="Filter" />
<TextBox
x:Name="txtFilterKeyword"
Grid.Row="0"
Grid.Column="1"
KeyDown="TxtFilterKeyword_OnKeyDown">
<attachedProperties:WatermarkService.Watermark>
<TextBlock VerticalAlignment="Center" Text="Press Enter to Apply" />
</attachedProperties:WatermarkService.Watermark>
</TextBox>
<StackPanel
Grid.Row="0"
Grid.Column="2"
Orientation="Horizontal">
<Button
x:Name="btnApplyFilter"
Click="BtnApplyFilter_OnClick"
ToolTip="Apply Filter">
<Button.Content>
<Path Data="M416 448L319 351Q277 383 224 383 181 383 144 362 107 340 86 303 64 266 64 223 64 180 86 143 107 106 144 85 181 63 224 63 267 63 304 85 341 106 363 143 384 180 384 223 384 277 351 319L448 416 416 448ZM223 336Q270 336 303 303 335 270 335 224 335 177 303 145 270 112 223 112 177 112 144 145 111 177 111 224 111 270 144 303 177 336 223 336Z" />
</Button.Content>
</Button>
<Button
x:Name="btnClearFilter"
Click="BtnClearFilter_OnClick"
ToolTip="Clear Filter">
<Button.Content>
<Path Data="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z">
<Path.LayoutTransform>
<ScaleTransform ScaleY="-1" />
</Path.LayoutTransform>
</Path>
</Button.Content>
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>