|
|
|
|
<UserControl x:Class="Kingo.Plugin.BHTB_Extract.View.UcZYQMagr"
|
|
|
|
|
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:local="clr-namespace:Kingo.Plugin.BHTB_Extract.View"
|
|
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DesignHeight="450" d:DesignWidth="300">
|
|
|
|
|
<UserControl.Resources>
|
|
|
|
|
<SolidColorBrush x:Key="ItemMouseOverBackground" Color="AliceBlue"></SolidColorBrush>
|
|
|
|
|
<SolidColorBrush x:Key="ItemSelectedBackground" Color="#FFDEEFFD"></SolidColorBrush>
|
|
|
|
|
<Style x:Key="DefaultTreeViewItem" TargetType="{x:Type TreeViewItem}">
|
|
|
|
|
<Setter Property="MinHeight" Value="20" />
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
|
<Setter Property="Margin" Value="0" />
|
|
|
|
|
<Setter Property="IsExpanded" Value="True" />
|
|
|
|
|
<Setter Property="IsSelected" Value="{Binding Checked, Mode=TwoWay}" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
|
|
|
|
<StackPanel>
|
|
|
|
|
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"
|
|
|
|
|
MinHeight="{TemplateBinding MinHeight}" UseLayoutRounding="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
|
|
|
<!--多层级间隔,暂缓-->
|
|
|
|
|
<!--<Grid Margin="{Binding Converter={StaticResource LengthConverter}, RelativeSource={x:Static RelativeSource.TemplatedParent}}"-->
|
|
|
|
|
<Grid Margin="{TemplateBinding Margin}" VerticalAlignment="Stretch">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition MinWidth="18" Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<!--展开收缩按钮-->
|
|
|
|
|
<ToggleButton x:Name="ExpanderBtn"
|
|
|
|
|
IsChecked="{Binding Path=IsExpanded, RelativeSource={x:Static RelativeSource.TemplatedParent}, Mode=TwoWay}"
|
|
|
|
|
ClickMode="Press" >
|
|
|
|
|
<ToggleButton.Template>
|
|
|
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
|
|
|
<Border>
|
|
|
|
|
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
|
|
|
</Border>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</ToggleButton.Template>
|
|
|
|
|
<ToggleButton.Content>
|
|
|
|
|
<!--<TextBlock x:Name="ExpanderIcon" Foreground="{TemplateBinding Foreground}" Text="" />-->
|
|
|
|
|
<!--<Image x:Name="ExpanderIcon" Source="../Resources/UnExpanded.png" Width="14" Height="14"/>-->
|
|
|
|
|
<Image x:Name="ExpanderIcon" Source="/Kingo.Plugin.BHTB_Extract;component/Resources/UnExpanded.png" Width="14" Height="14"/>
|
|
|
|
|
</ToggleButton.Content>
|
|
|
|
|
</ToggleButton>
|
|
|
|
|
<!--内容-->
|
|
|
|
|
<ContentPresenter x:Name="PART_Header" Grid.Column="1" ContentSource="Header"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
<ItemsPresenter Margin="18,0,0,0" x:Name="ItemsHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
|
|
|
</StackPanel>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsExpanded" Value="False">
|
|
|
|
|
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsExpanded" Value="True">
|
|
|
|
|
<!--<Setter TargetName="ExpanderIcon" Property="Source" Value="../Resources/Expanded.png" />-->
|
|
|
|
|
<Setter TargetName="ExpanderIcon" Property="Source" Value="/Kingo.Plugin.BHTB_Extract;component/Resources/Expanded.png" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
|
|
|
|
<Setter TargetName="ExpanderIcon" Property="Visibility" Value="Hidden" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Background" Value="{StaticResource ItemMouseOverBackground}" />
|
|
|
|
|
<!--<Setter Property="Foreground" Value="{StaticResource ItemMouseOverForeground}" />-->
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
|
|
|
|
<Setter Property="Background" Value="{StaticResource ItemSelectedBackground}" />
|
|
|
|
|
<!--<Setter Property="Foreground" Value="{StaticResource ItemSelectedForeground}" />-->
|
|
|
|
|
</Trigger>
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
|
<Condition Property="IsSelected" Value="True" />
|
|
|
|
|
<Condition Property="Selector.IsSelectionActive" Value="True" />
|
|
|
|
|
</MultiTrigger.Conditions>
|
|
|
|
|
<Setter Property="Background" Value="{StaticResource ItemSelectedBackground}" />
|
|
|
|
|
<!--<Setter Property="Foreground" Value="{StaticResource ItemSelectedForeground}" />-->
|
|
|
|
|
</MultiTrigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<!--<Setter Property="ContextMenu" Value="{StaticResource RouterMenu}" />-->
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<!--TreeView样式-->
|
|
|
|
|
<Style TargetType="{x:Type TreeView}">
|
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
|
|
|
|
<Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"></Setter>
|
|
|
|
|
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling" />
|
|
|
|
|
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
|
|
|
|
<!--<Setter Property="Background" Value="{StaticResource ItemsContentBackground}"/>-->
|
|
|
|
|
<Setter Property="ItemContainerStyle" Value="{StaticResource DefaultTreeViewItem}"></Setter>
|
|
|
|
|
<Setter Property="ItemsPanel">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<VirtualizingStackPanel IsItemsHost="True" IsVirtualizing="True" VirtualizationMode="Recycling" Margin="0"/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
</UserControl.Resources>
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.Resources>
|
|
|
|
|
<HierarchicalDataTemplate x:Key="ItemNode" ItemsSource="{Binding Nodes,Mode=TwoWay}" >
|
|
|
|
|
<Grid Height="28">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="auto" />
|
|
|
|
|
<ColumnDefinition />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<Image Width="18" Source="{Binding Icon}" Height="18" Margin="8,0" Grid.Column="0" />
|
|
|
|
|
<TextBlock Name="txtBox" Text="{Binding Name}" FontSize="13" Grid.Column="1" VerticalAlignment="Center" ContextMenu="{Binding cMenu}" Margin="3,0,0,0">
|
|
|
|
|
</TextBlock>
|
|
|
|
|
</Grid>
|
|
|
|
|
<HierarchicalDataTemplate.Triggers>
|
|
|
|
|
<DataTrigger Binding="{Binding IsOpenEdit,Mode=TwoWay}" Value="true">
|
|
|
|
|
<Setter TargetName="txtBox" Property="Foreground" Value="Red" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</HierarchicalDataTemplate.Triggers>
|
|
|
|
|
</HierarchicalDataTemplate>
|
|
|
|
|
</Grid.Resources>
|
|
|
|
|
<TreeView Grid.Row="0" x:Name="tvTypes" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemTemplate="{StaticResource ItemNode}"
|
|
|
|
|
SelectedItemChanged="tvTypes_SelectedItemChanged" PreviewMouseLeftButtonDown="tvTypes_PreviewMouseLeftButtonDown">
|
|
|
|
|
<!--<TreeView.ItemContainerStyle>
|
|
|
|
|
<Style TargetType="{x:Type TreeViewItem}">
|
|
|
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"></Setter>
|
|
|
|
|
<Setter Property="IsSelected" Value="{Binding Checked}"></Setter>
|
|
|
|
|
<EventSetter Event="TreeViewItem.PreviewMouseRightButtonDown" Handler="tvTypes_PreviewMouseRightButtonDown"/>
|
|
|
|
|
</Style>
|
|
|
|
|
</TreeView.ItemContainerStyle>-->
|
|
|
|
|
<!--<TreeViewItem Header="测试" />-->
|
|
|
|
|
</TreeView>
|
|
|
|
|
</Grid>
|
|
|
|
|
</UserControl>
|