2022-10-28 22:45:39 +08:00
|
|
|
<UserControl x:Class="AIStudio.Wpf.DiagramApp.Views.ToolBoxControl"
|
2021-07-23 09:42:22 +08:00
|
|
|
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"
|
2022-10-28 22:45:39 +08:00
|
|
|
xmlns:views="clr-namespace:AIStudio.Wpf.DiagramApp.Views"
|
|
|
|
|
xmlns:viewmodels="clr-namespace:AIStudio.Wpf.DiagramApp.ViewModels"
|
|
|
|
|
xmlns:model="clr-namespace:AIStudio.Wpf.DiagramApp.Models"
|
2022-11-30 19:07:40 +08:00
|
|
|
xmlns:flowchartmodel="clr-namespace:AIStudio.Wpf.Flowchart.Models;assembly=AIStudio.Wpf.Flowchart"
|
|
|
|
|
xmlns:sfcmodel="clr-namespace:AIStudio.Wpf.SFC.Models;assembly=AIStudio.Wpf.SFC"
|
|
|
|
|
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
2023-05-27 12:35:44 +08:00
|
|
|
xmlns:drop="urn:gong-wpf-dragdrop"
|
|
|
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
2023-01-25 15:58:05 +08:00
|
|
|
xmlns:conventer="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Converters;assembly=AIStudio.Wpf.DiagramDesigner.Additionals"
|
|
|
|
|
xmlns:command="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Commands;assembly=AIStudio.Wpf.DiagramDesigner.Additionals"
|
2022-12-12 22:33:17 +08:00
|
|
|
xmlns:svg="https://gitee.com/akwkevin/aistudio.-wpf.-test/tree/master/Controls/AIStudio.Wpf.Svg2XamlExtension"
|
2023-05-27 12:35:44 +08:00
|
|
|
xmlns:binding="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Commands;assembly=AIStudio.Wpf.DiagramDesigner.Additionals"
|
|
|
|
|
xmlns:Fluent="urn:fluent-ribbon"
|
|
|
|
|
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
2021-07-23 09:42:22 +08:00
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DesignHeight="300" d:DesignWidth="300">
|
|
|
|
|
<UserControl.Resources>
|
|
|
|
|
<ResourceDictionary>
|
2023-12-23 10:14:08 +08:00
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
|
|
|
<ResourceDictionary>
|
|
|
|
|
<conventer:StringPathConverter x:Key="stringPathConverter"/>
|
|
|
|
|
<conventer:IntVisibilityConverter x:Key="IntVisibilityConverter"/>
|
|
|
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
|
|
|
<dd:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
|
|
|
|
|
<command:CommandReference x:Key="DeleteItemCommandReference" Command="{Binding ToolBoxViewModel.DeleteItemCommand}"/>
|
|
|
|
|
<dd:MathConverter x:Key="MathAddConverter" Operation="Add" />
|
|
|
|
|
|
2022-11-30 19:07:40 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
<DataTemplate DataType="{x:Type model:ImageToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Image IsHitTestVisible="True"
|
|
|
|
|
Stretch="Fill"
|
|
|
|
|
Margin="2"
|
|
|
|
|
Source="{Binding Icon, Converter={x:Static dd:ImageUrlConverter.Instance}}" />
|
2021-07-23 09:42:22 +08:00
|
|
|
</Grid>
|
2023-12-23 10:14:08 +08:00
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:MediaToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Image IsHitTestVisible="True"
|
|
|
|
|
Stretch="Fill"
|
|
|
|
|
Margin="2"
|
|
|
|
|
Source="{Binding Text, Converter={x:Static dd:ImageUrlConverter.Instance}}" />
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:TextToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Rectangle Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}" Margin="2"/>
|
|
|
|
|
<TextBlock Text="{Binding Text}" FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:EllipseTextToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Ellipse Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Ellipse Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}" Margin="2"/>
|
|
|
|
|
<TextBlock Text="{Binding Text}" FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:PathToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Path Style="{StaticResource PathItemStyle}" ToolTip="Document" Margin="2"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:SvgToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<svg:PackSvg Width="Auto" Height="Auto" Path="{Binding Icon}" Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:DesignerItemToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Grid.ContextMenu>
|
|
|
|
|
<ContextMenu>
|
|
|
|
|
<MenuItem Header="删除" Command="{StaticResource DeleteItemCommandReference}" CommandParameter="{Binding .}"/>
|
|
|
|
|
</ContextMenu>
|
|
|
|
|
</Grid.ContextMenu>
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Viewbox Stretch="Uniform" DataContext="{Binding DesignerItemViewModel}" Margin="2">
|
|
|
|
|
<Grid Width="{Binding ItemWidth}" Height="{Binding ItemHeight}" IsHitTestVisible="False">
|
|
|
|
|
<ContentControl Content="{Binding .}" />
|
|
|
|
|
<TextBox Text="{Binding Text}"
|
|
|
|
|
IsReadOnly="True"
|
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
|
Background ="Transparent"
|
|
|
|
|
BorderThickness="0"
|
|
|
|
|
Margin="5"
|
|
|
|
|
Foreground="{Binding FontViewModel.FontColor,Converter={StaticResource ColorBrushConverter}}"
|
|
|
|
|
FontSize="{Binding FontViewModel.FontSize}"
|
|
|
|
|
FontFamily="{Binding FontViewModel.FontFamily}"
|
|
|
|
|
FontWeight="{Binding FontViewModel.FontWeight}"
|
|
|
|
|
FontStyle="{Binding FontViewModel.FontStyle}"
|
|
|
|
|
FontStretch="{Binding FontViewModel.FontStretch}"
|
|
|
|
|
TextDecorations="{Binding FontViewModel.TextDecorations}"
|
|
|
|
|
HorizontalContentAlignment="{Binding FontViewModel.HorizontalAlignment}"
|
|
|
|
|
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
|
|
|
|
|
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Viewbox>
|
2021-07-23 09:42:22 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type model:MultipleDesignerItemToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Grid.ContextMenu>
|
|
|
|
|
<ContextMenu>
|
|
|
|
|
<MenuItem Header="删除" Command="{StaticResource DeleteItemCommandReference}" CommandParameter="{Binding .}"/>
|
|
|
|
|
</ContextMenu>
|
|
|
|
|
</Grid.ContextMenu>
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Viewbox Stretch="Uniform" Margin="2">
|
|
|
|
|
<ItemsControl ItemsSource="{Binding SelectableDesignerItemViewModels}"
|
|
|
|
|
Width="{Binding CanvasWidth}"
|
|
|
|
|
Height="{Binding CanvasHeight}">
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<Canvas x:Name="rootCanvas"/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsControl.Template>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ItemsControl}">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</ItemsControl.Template>
|
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Grid Width="{Binding ItemWidth}" Height="{Binding ItemHeight}" IsHitTestVisible="False">
|
|
|
|
|
<ContentControl Content="{Binding .}" Margin="2"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
|
<ItemsControl.ItemContainerStyle>
|
|
|
|
|
<Style>
|
|
|
|
|
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
|
|
|
|
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Binding="{Binding IsConnection}" Value="True">
|
|
|
|
|
<Setter Property="Canvas.Left" Value="{Binding Area.Left}" />
|
|
|
|
|
<Setter Property="Canvas.Top" Value="{Binding Area.Top}" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</ItemsControl.ItemContainerStyle>
|
|
|
|
|
<ItemsControl.Resources>
|
|
|
|
|
<DataTemplate DataType="{x:Type dd:ConnectionViewModel}">
|
|
|
|
|
<Grid>
|
|
|
|
|
<dd:LineControl x:Name="line"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ItemsControl.Resources>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
</Viewbox>
|
2023-02-03 18:23:53 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type flowchartmodel:FlowchartToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Grid IsHitTestVisible="False">
|
|
|
|
|
<ContentControl Style="{StaticResource CustomFlowNodeStyle}" Margin="2"/>
|
|
|
|
|
<TextBlock Text="{Binding Text}" Margin="5" TextWrapping="WrapWithOverflow" FontSize="9" Foreground="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type sfcmodel:SFCToolBoxData}">
|
|
|
|
|
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Kind,Converter={StaticResource EnumDescriptionConverter}}">
|
|
|
|
|
<Rectangle Name="Border"
|
|
|
|
|
StrokeThickness="1"
|
|
|
|
|
StrokeDashArray="2"
|
|
|
|
|
Fill="Transparent"
|
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
|
<Grid IsHitTestVisible="False">
|
|
|
|
|
<ContentControl Style="{StaticResource CustomSFCNodeStyle}" Margin="2" />
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
<DataTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
<DataTemplate DataType="{x:Type dd:ToolBoxCategory}">
|
|
|
|
|
<Grid Visibility="{Binding IsChecked,Converter={StaticResource boolToVisibilityConverter}}">
|
|
|
|
|
<Expander Header="{Binding Header}"
|
|
|
|
|
IsExpanded="{Binding IsExpanded}"
|
|
|
|
|
BorderThickness="0"
|
|
|
|
|
Background="Transparent"
|
|
|
|
|
Foreground="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}"
|
|
|
|
|
Style="{StaticResource AIStudio.DiagramApp.Styles.Expander}">
|
|
|
|
|
<ItemsControl ItemsSource="{Binding ToolBoxItems}">
|
|
|
|
|
<ItemsControl.Template>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ItemsControl}">
|
|
|
|
|
<Border BorderThickness="{TemplateBinding Border.BorderThickness}"
|
|
|
|
|
Padding="{TemplateBinding Control.Padding}"
|
|
|
|
|
BorderBrush="{TemplateBinding Border.BorderBrush}"
|
|
|
|
|
Background="{TemplateBinding Panel.Background}"
|
|
|
|
|
SnapsToDevicePixels="True">
|
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</Border>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</ItemsControl.Template>
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<WrapPanel Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ItemsControl}}, Path=ActualWidth}"/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsControl.ItemContainerStyle>
|
|
|
|
|
<Style TargetType="{x:Type ContentPresenter}">
|
|
|
|
|
<Setter Property="Control.Padding"
|
|
|
|
|
Value="10" />
|
|
|
|
|
<Setter Property="ContentControl.HorizontalContentAlignment"
|
|
|
|
|
Value="Stretch" />
|
|
|
|
|
<Setter Property="ContentControl.VerticalContentAlignment"
|
|
|
|
|
Value="Stretch" />
|
|
|
|
|
<Setter Property="ToolTip"
|
|
|
|
|
Value="{Binding ToolTip}" />
|
|
|
|
|
<Setter Property="dd:DragAndDropProps.EnabledForDrag"
|
|
|
|
|
Value="True" />
|
|
|
|
|
</Style>
|
|
|
|
|
</ItemsControl.ItemContainerStyle>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
</Expander>
|
|
|
|
|
<Button Margin="5" ToolTip="移除" Command="{Binding DataContext.ToolBoxViewModel.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" CommandParameter="{Binding .}" Width="16" Height="16" HorizontalAlignment="Right" VerticalAlignment="Top" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
|
|
|
|
|
<Path Stretch="Fill" Margin="2" Fill="Red" Data="M0.7,0 L5,4.3 L9.3,0 L10,0.7 L5.7,5 L10,9.3 L9.3,10 L5,5.7 L0.7,10 L0,9.3 L4.3,5 L0,0.7 z" ></Path>
|
|
|
|
|
</Button>
|
|
|
|
|
</Grid>
|
|
|
|
|
</DataTemplate>
|
2021-07-23 09:42:22 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
<DataTemplate DataType="{x:Type viewmodels:MineToolBoxCategory}">
|
|
|
|
|
<Grid Visibility="{Binding IsChecked,Converter={StaticResource boolToVisibilityConverter}}">
|
|
|
|
|
<Expander Header="{Binding Header}"
|
|
|
|
|
IsExpanded="{Binding IsExpanded}"
|
|
|
|
|
BorderThickness="0"
|
|
|
|
|
Background="Transparent"
|
|
|
|
|
Foreground="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}"
|
|
|
|
|
Style="{StaticResource AIStudio.DiagramApp.Styles.Expander}">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Border BorderThickness="1" CornerRadius="5" Margin="5" Padding="10" Visibility="{Binding ToolBoxItems.Count, Converter={StaticResource IntVisibilityConverter}, ConverterParameter='0'}">
|
|
|
|
|
<Border.BorderBrush>
|
|
|
|
|
<LinearGradientBrush SpreadMethod="Repeat" StartPoint="0,5" EndPoint="5,0" MappingMode="Absolute">
|
|
|
|
|
<LinearGradientBrush.GradientStops>
|
|
|
|
|
<GradientStop Color="{DynamicResource Fluent.Ribbon.Colors.AccentBaseColor}" Offset="0"/>
|
|
|
|
|
<GradientStop Color="{DynamicResource Fluent.Ribbon.Colors.AccentBaseColor}" Offset="0.2"/>
|
|
|
|
|
<GradientStop Color="Transparent" Offset="0.4"/>
|
|
|
|
|
<GradientStop Color="Transparent" Offset="0.6"/>
|
|
|
|
|
<GradientStop Color="{DynamicResource Fluent.Ribbon.Colors.AccentBaseColor}" Offset="0.8"/>
|
|
|
|
|
<GradientStop Color="{DynamicResource Fluent.Ribbon.Colors.AccentBaseColor}" Offset="1"/>
|
|
|
|
|
</LinearGradientBrush.GradientStops>
|
|
|
|
|
</LinearGradientBrush>
|
|
|
|
|
</Border.BorderBrush>
|
2021-07-23 09:42:22 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
<TextBlock Text="添加形状到我的符号" HorizontalAlignment="Center" Foreground="{DynamicResource GrayBrush2}"/>
|
|
|
|
|
</Border>
|
|
|
|
|
<ItemsControl ItemsSource="{Binding ToolBoxItems}">
|
|
|
|
|
<ItemsControl.Template>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ItemsControl}">
|
|
|
|
|
<Border BorderThickness="{TemplateBinding Border.BorderThickness}"
|
|
|
|
|
Padding="{TemplateBinding Control.Padding}"
|
|
|
|
|
BorderBrush="{TemplateBinding Border.BorderBrush}"
|
|
|
|
|
Background="{TemplateBinding Panel.Background}"
|
|
|
|
|
SnapsToDevicePixels="True">
|
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</Border>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</ItemsControl.Template>
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<WrapPanel Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ItemsControl}}, Path=ActualWidth}"/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsControl.ItemContainerStyle>
|
|
|
|
|
<Style TargetType="{x:Type ContentPresenter}">
|
|
|
|
|
<Setter Property="Control.Padding"
|
|
|
|
|
Value="10" />
|
|
|
|
|
<Setter Property="ContentControl.HorizontalContentAlignment"
|
|
|
|
|
Value="Stretch" />
|
|
|
|
|
<Setter Property="ContentControl.VerticalContentAlignment"
|
|
|
|
|
Value="Stretch" />
|
|
|
|
|
<Setter Property="ToolTip"
|
|
|
|
|
Value="{Binding ToolTip}" />
|
|
|
|
|
<Setter Property="dd:DragAndDropProps.EnabledForDrag"
|
|
|
|
|
Value="True" />
|
|
|
|
|
</Style>
|
|
|
|
|
</ItemsControl.ItemContainerStyle>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Expander>
|
|
|
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top">
|
|
|
|
|
<Button Margin="0,5,2,5" ToolTip="导入到我的符号" Command="{Binding DataContext.ToolBoxViewModel.ImportItemCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
|
|
|
|
|
<Path Stretch="Fill" Margin="2" Fill="{DynamicResource GrayBrush2}" Data="M14,12L10,8V11H2V13H10V16M20,18V6C20,4.89 19.1,4 18,4H6A2,2 0 0,0 4,6V9H6V6H18V18H6V15H4V18A2,2 0 0,0 6,20H18A2,2 0 0,0 20,18Z" ></Path>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button Margin="0,5,2,5" ToolTip="添加到我的符号" Command="{Binding DataContext.ToolBoxViewModel.AddCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
|
|
|
|
|
<Path Stretch="Fill" Margin="2" Fill="{DynamicResource GrayBrush2}" Data="M938.666667 426.666667h-341.333334V85.333333c0-46.933333-38.4-85.333333-85.333333-85.333333s-85.333333 38.4-85.333333 85.333333v341.333334H85.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333s38.4 85.333333 85.333333 85.333333h341.333334v341.333334c0 46.933333 38.4 85.333333 85.333333 85.333333s85.333333-38.4 85.333333-85.333333v-341.333334h341.333334c46.933333 0 85.333333-38.4 85.333333-85.333333s-38.4-85.333333-85.333333-85.333333z" ></Path>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button Margin="0,5,5,5" ToolTip="移除" Command="{Binding DataContext.ToolBoxViewModel.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" CommandParameter="{Binding .}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
|
|
|
|
|
<Path Stretch="Fill" Margin="2" Fill="Red" Data="M0.7,0 L5,4.3 L9.3,0 L10,0.7 L5.7,5 L10,9.3 L9.3,10 L5,5.7 L0.7,10 L0,9.3 L4.3,5 L0,0.7 z" ></Path>
|
|
|
|
|
</Button>
|
|
|
|
|
</StackPanel>
|
2021-07-23 09:42:22 +08:00
|
|
|
</Grid>
|
2023-12-23 10:14:08 +08:00
|
|
|
</DataTemplate>
|
2021-07-23 09:42:22 +08:00
|
|
|
|
2023-12-23 10:14:08 +08:00
|
|
|
</ResourceDictionary>
|
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2021-07-23 09:42:22 +08:00
|
|
|
</ResourceDictionary>
|
2023-12-23 10:14:08 +08:00
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
</UserControl.Resources>
|
|
|
|
|
<Grid>
|
2023-07-08 18:00:14 +08:00
|
|
|
<Expander x:Name="expanderLeft" ExpandDirection="Left" IsExpanded="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=views:ToolBoxControl}}" Style="{StaticResource AIStudio.DiagramApp.Styles.Expander.AutoHide}" Margin="0,0,1,0">
|
2021-07-23 09:42:22 +08:00
|
|
|
<Expander.Header>
|
|
|
|
|
<DockPanel Height="26">
|
2023-07-08 18:00:14 +08:00
|
|
|
<ToggleButton DockPanel.Dock="Right" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=views:ToolBoxControl}}" Background="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" Style="{StaticResource AIStudio.DiagramApp.Styles.ToggleButton}">
|
2021-07-23 09:42:22 +08:00
|
|
|
<Path Fill="Black" Stretch="Fill" Width="16" Height="16" Margin="10,3" Data="M18.41,7.41L17,6L11,12L17,18L18.41,16.59L13.83,12L18.41,7.41M12.41,7.41L11,6L5,12L11,18L12.41,16.59L7.83,12L12.41,7.41Z"/>
|
|
|
|
|
</ToggleButton>
|
2023-05-27 12:35:44 +08:00
|
|
|
|
|
|
|
|
<ToggleButton x:Name="shift" HorizontalAlignment="Left" Width="130" ToolTip="符号库与表单切换">
|
|
|
|
|
<ToggleButton.Style>
|
2023-07-08 18:00:14 +08:00
|
|
|
<Style BasedOn="{StaticResource AIStudio.Mind.Styles.Button.Flat}" TargetType="{x:Type ToggleButton}">
|
2023-05-27 12:35:44 +08:00
|
|
|
<Setter Property="Content">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<TextBlock Text="符号库" Width="50" TextAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M234.666667 430.933333H128l85.333333-81.066666L345.6 213.333333l51.2 51.2-81.066667 81.066667H896V426.666667H234.666667v4.266666zM793.6 554.666667H896l-85.333333 81.066666-132.266667 132.266667-51.2-51.2 81.066667-81.066667H128V554.666667h665.6z"></Path>
|
|
|
|
|
<TextBlock Text="页面" Width="50" TextAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
|
|
|
|
<Trigger.Setters>
|
|
|
|
|
<Setter Property="Content">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<TextBlock Text="页面" Width="50" TextAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M234.666667 430.933333H128l85.333333-81.066666L345.6 213.333333l51.2 51.2-81.066667 81.066667H896V426.666667H234.666667v4.266666zM793.6 554.666667H896l-85.333333 81.066666-132.266667 132.266667-51.2-51.2 81.066667-81.066667H128V554.666667h665.6z"></Path>
|
|
|
|
|
<TextBlock Text="符号库" Width="50" TextAlignment="Center" VerticalAlignment="Center"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Trigger.Setters>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</ToggleButton.Style>
|
|
|
|
|
</ToggleButton>
|
|
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
</Expander.Header>
|
2023-05-27 12:35:44 +08:00
|
|
|
<Grid x:Name="grid" Width="225" MinWidth="100" MaxWidth="500">
|
|
|
|
|
<i:Interaction.Triggers>
|
|
|
|
|
<i:DataTrigger Binding="{Binding ElementName=shift,Path=IsChecked}" Value="False">
|
|
|
|
|
<i:GoToStateAction StateName="ShowTool" />
|
|
|
|
|
</i:DataTrigger>
|
|
|
|
|
<i:DataTrigger Binding="{Binding ElementName=shift,Path=IsChecked}" Value="True">
|
|
|
|
|
<i:GoToStateAction StateName="ShowPage" />
|
|
|
|
|
</i:DataTrigger>
|
|
|
|
|
</i:Interaction.Triggers>
|
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
|
|
|
<VisualStateGroup x:Name="VisualStates">
|
|
|
|
|
<VisualState x:Name="ShowTool">
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="tool" Duration="0">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="page" Duration="0">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
|
|
|
|
<VisualState x:Name="ShowPage">
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="tool" Duration="0">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="page" Duration="0">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
|
|
|
|
</VisualStateGroup>
|
|
|
|
|
</VisualStateManager.VisualStateGroups>
|
|
|
|
|
|
|
|
|
|
<Grid x:Name="tool" DataContext="{Binding ToolBoxViewModel}">
|
2021-07-23 09:42:22 +08:00
|
|
|
<Grid.ContextMenu>
|
|
|
|
|
<ContextMenu ItemsSource="{Binding ToolBoxCategory}">
|
|
|
|
|
<ContextMenu.ItemContainerStyle>
|
|
|
|
|
<Style TargetType="MenuItem">
|
|
|
|
|
<Setter Property="IsCheckable" Value="True" />
|
|
|
|
|
<Setter Property="IsChecked" Value="{Binding IsChecked}"/>
|
|
|
|
|
</Style>
|
|
|
|
|
</ContextMenu.ItemContainerStyle>
|
|
|
|
|
<ContextMenu.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<TextBlock Text="{Binding Header}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ContextMenu.ItemTemplate>
|
|
|
|
|
</ContextMenu>
|
|
|
|
|
</Grid.ContextMenu>
|
|
|
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
|
|
|
|
<ItemsControl x:Name="listbox" ItemsSource="{Binding ToolBoxCategory}" Padding="0,0,0,0" BorderThickness="0">
|
|
|
|
|
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</Grid>
|
2023-05-27 12:35:44 +08:00
|
|
|
|
|
|
|
|
<Grid x:Name="page" Visibility="Collapsed">
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition/>
|
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<ListBox ItemsSource="{Binding PageViewModel.DiagramViewModels}"
|
|
|
|
|
SelectedItem="{Binding PageViewModel.DiagramViewModel}"
|
|
|
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
|
Padding="0"
|
|
|
|
|
Margin="0,0,3,0"
|
|
|
|
|
Background="Transparent"
|
|
|
|
|
HorizontalContentAlignment="Stretch"
|
|
|
|
|
drop:DragDrop.CanDragWithMouseRightButton="True"
|
|
|
|
|
drop:DragDrop.IsDragSource="True"
|
|
|
|
|
drop:DragDrop.IsDropTarget="True"
|
|
|
|
|
drop:DragDrop.DropTargetAdornerBrush="Coral"
|
|
|
|
|
drop:DragDrop.UseDefaultEffectDataTemplate="True">
|
|
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<StackPanel/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ListBox.ItemsPanel>
|
|
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Grid >
|
2024-02-08 23:00:50 +08:00
|
|
|
<Border Margin="3" Height="100" Background="{Binding Thumbnail}" RenderOptions.BitmapScalingMode="HighQuality" BorderThickness="1" BorderBrush="LightGray">
|
2023-05-27 12:35:44 +08:00
|
|
|
<Border.ContextMenu>
|
|
|
|
|
<ContextMenu>
|
|
|
|
|
<MenuItem Header="增加页" Command="{binding:ControlBinding PageViewModel.AddPageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
<MenuItem Header="复制页" Command="{binding:ControlBinding PageViewModel.AddCopyPageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
<MenuItem Header="重命名页" Command="{binding:ControlBinding PageViewModel.RenamePageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
<MenuItem Header="删除页" Command="{binding:ControlBinding PageViewModel.DeletePageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
</ContextMenu>
|
|
|
|
|
</Border.ContextMenu>
|
|
|
|
|
<Grid>
|
|
|
|
|
<TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" >
|
|
|
|
|
<TextBlock.InputBindings>
|
|
|
|
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{binding:ControlBinding PageViewModel.RenamePageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
</TextBlock.InputBindings>
|
|
|
|
|
</TextBlock>
|
|
|
|
|
<TextBox x:Name="renametextbox" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Name,UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding IsEditName,Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
|
|
|
<TextBox.InputBindings>
|
|
|
|
|
<KeyBinding Key="Enter" Command="{binding:ControlBinding PageViewModel.EndRenamePageCommand}" CommandParameter="{Binding .}"/>
|
|
|
|
|
</TextBox.InputBindings>
|
|
|
|
|
<TextBox.Style>
|
|
|
|
|
<Style TargetType="TextBox">
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Binding="{Binding Visibility,ElementName=renametextbox}" Value="Visible">
|
|
|
|
|
<Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=renametextbox}"/>
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</TextBox.Style>
|
|
|
|
|
<i:Interaction.Triggers>
|
|
|
|
|
<i:EventTrigger EventName="LostFocus">
|
|
|
|
|
<i:InvokeCommandAction Command="{binding:ControlBinding PageViewModel.EndRenamePageCommand}" CommandParameter="{Binding .}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
</i:Interaction.Triggers>
|
|
|
|
|
</TextBox>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
|
</ListBox>
|
|
|
|
|
<Fluent:Button Size="Small" Grid.Row="1" HorizontalAlignment="Center" Icon="{iconPacks:Material Kind=Plus}" Command="{Binding PageViewModel.AddPageCommand}"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
</Grid>
|
2021-07-23 09:42:22 +08:00
|
|
|
</Expander>
|
|
|
|
|
<dd:BorderResizeThumb Width="1" Margin="-3,0,0,0" ResizeElement="{Binding ElementName=grid}" Cursor="SizeWE" HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=views:ToolBoxControl},Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</UserControl>
|