mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
117 lines
6.7 KiB
XML
117 lines
6.7 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
|
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.Mind.ViewModels"
|
|
xmlns:controls="clr-namespace:AIStudio.Wpf.Mind.Controls">
|
|
|
|
<dd:ColorBrushConverter x:Key="ColorBrushConverter"/>
|
|
<dd:DoubleToCornerRadius x:Key="DoubleToCornerRadius"/>
|
|
<dd:IntToVisibilityConverter x:Key="IntToVisibilityConverter"/>
|
|
<dd:DoubleToThickness x:Key="DoubleToThickness"/>
|
|
|
|
<!-- Toggle Button -->
|
|
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
|
|
<Setter Property="Focusable" Value="False"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
<Grid Width="17" Height="17" SnapsToDevicePixels="True">
|
|
<Rectangle Width="13" Height="13" Stroke="Gray" RadiusX="6" RadiusY="6" SnapsToDevicePixels="true">
|
|
<Rectangle.Fill>
|
|
<LinearGradientBrush EndPoint="0.5,2" StartPoint="0.5,0">
|
|
<GradientStop Color="White" Offset="0"/>
|
|
<GradientStop Color="Silver" Offset="0.5"/>
|
|
<GradientStop Color="LightGray" Offset="1"/>
|
|
</LinearGradientBrush>
|
|
</Rectangle.Fill>
|
|
</Rectangle>
|
|
<Rectangle x:Name="ExpandPath" Width="1" Height="9" Stroke="Gray" SnapsToDevicePixels="true" />
|
|
<Rectangle Width="9" Height="1" Stroke="Gray" SnapsToDevicePixels="true"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter Property="Visibility" TargetName="ExpandPath" Value="Collapsed"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<ControlTemplate x:Key="MindNodeLevelStyle" TargetType="{x:Type ContentControl}">
|
|
<Grid>
|
|
<Grid.ContextMenu>
|
|
<ContextMenu ItemsSource="{Binding MenuOptions}">
|
|
<ContextMenu.ItemContainerStyle>
|
|
<Style TargetType="MenuItem">
|
|
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
|
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
|
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
|
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
|
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
|
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
|
</Style>
|
|
</ContextMenu.ItemContainerStyle>
|
|
</ContextMenu>
|
|
</Grid.ContextMenu>
|
|
|
|
<Grid IsHitTestVisible="False">
|
|
<Border BorderThickness="{Binding BorderThickness}"
|
|
BorderBrush="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
|
Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
|
CornerRadius="{Binding CornerRadius}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<Image x:Name="image" Source="{Binding Icon}" Stretch="Fill" Width="64" Height="64" Visibility="Collapsed"/>
|
|
<Grid Grid.Row="1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<controls:RateControl Grid.Column="0" />
|
|
<controls:PriorityControl Grid.Column="1"/>
|
|
<dd:TextControl Grid.Column="2"/>
|
|
<controls:LinkControl Grid.Column="3"/>
|
|
<controls:RemarkControl Grid.Column="4"/>
|
|
<controls:TagControl Grid.Column="5"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
<ToggleButton x:Name="toggle" IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding ConnectorOrientation}" Value="None">
|
|
<Setter TargetName="toggle" Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding ConnectorOrientation}" Value="Right">
|
|
<Setter TargetName="toggle" Property="HorizontalAlignment" Value="Right"/>
|
|
<Setter TargetName="toggle" Property="Margin" Value="0,0,-15,0"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding ConnectorOrientation}" Value="Top">
|
|
<Setter TargetName="toggle" Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter TargetName="toggle" Property="VerticalAlignment" Value="Top"/>
|
|
<Setter TargetName="toggle" Property="Margin" Value="0,-15,0,0"/>
|
|
</DataTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="MindNodeStyle" TargetType="{x:Type ContentControl}">
|
|
<Setter Property="Template" Value="{StaticResource MindNodeLevelStyle}" />
|
|
</Style>
|
|
|
|
<DataTemplate DataType="{x:Type viewmodel:MindNode}">
|
|
<Grid>
|
|
<ContentControl Style="{StaticResource MindNodeStyle}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
|
|
</ResourceDictionary> |