mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-01 13:39:28 +08:00
分离出一个小demo
This commit is contained in:
@@ -42,29 +42,6 @@ namespace AIStudio.Wpf.DiagramApp.Models
|
||||
}
|
||||
}
|
||||
|
||||
public class FlowchartToolBoxData : ToolBoxData
|
||||
{
|
||||
public NodeKinds Kind { get; set; }
|
||||
public FlowchartToolBoxData(NodeKinds kind, Type type, double width = 32, double height = 32) : base(kind.GetDescription(), null, type, width, height)
|
||||
{
|
||||
Kind = kind;
|
||||
ColorViewModel.LineColor.Color = Colors.Black;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SFCToolBoxData : ToolBoxData
|
||||
{
|
||||
public SFCNodeKinds Kind { get; set; }
|
||||
public SFCToolBoxData(SFCNodeKinds kind, Type type, double width = 32, double height = 32) : base(null, null, type, width, height)
|
||||
{
|
||||
Kind = kind;
|
||||
ColorViewModel.LineColor.Color = Colors.Gray;
|
||||
ColorViewModel.FillColor.Color = Colors.Blue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class DesignerItemToolBoxData : ToolBoxData
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
|
||||
@@ -16,6 +16,8 @@ using AIStudio.Wpf.DiagramDesigner.Helpers;
|
||||
using AIStudio.Wpf.SFC;
|
||||
using AIStudio.Wpf.SFC.ViewModels;
|
||||
using System.Windows.Media;
|
||||
using AIStudio.Wpf.Flowchart.Models;
|
||||
using AIStudio.Wpf.SFC.Models;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.DiagramHelper.Helpers;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.DiagramApp.Models"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:drop="urn:gong-wpf-dragdrop"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.DiagramHelper.Converters;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
xmlns:views="clr-namespace:AIStudio.Wpf.DiagramApp.Views"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.DiagramHelper.Converters;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.DiagramHelper.Helpers;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:flowchart="clr-namespace:AIStudio.Wpf.Flowchart;assembly=AIStudio.Wpf.Flowchart"
|
||||
mc:Ignorable="d"
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
xmlns:views="clr-namespace:AIStudio.Wpf.DiagramApp.Views"
|
||||
xmlns:viewmodels="clr-namespace:AIStudio.Wpf.DiagramApp.ViewModels"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.DiagramApp.Models"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
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"
|
||||
xmlns:conventer="clr-namespace:AIStudio.Wpf.DiagramHelper.Converters;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
xmlns:command="clr-namespace:AIStudio.Wpf.DiagramHelper.Commands;assembly=AIStudio.Wpf.DiagramHelper"
|
||||
xmlns:svg="clr-namespace:Svg2XamlTestExtension;assembly=Svg2XamlTestExtension"
|
||||
@@ -19,7 +21,7 @@
|
||||
<dd:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
|
||||
<command:CommandReference x:Key="DeleteItemCommandReference" Command="{Binding DeleteItemCommand}"/>
|
||||
|
||||
|
||||
|
||||
<DataTemplate DataType="{x:Type model:ImageToolBoxData}">
|
||||
<Grid Width="{Binding Width}" Height="{Binding Height}">
|
||||
<Rectangle Name="Border"
|
||||
@@ -159,19 +161,17 @@
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type model:FlowchartToolBoxData}">
|
||||
<DataTemplate DataType="{x:Type flowchartmodel:FlowchartToolBoxData}">
|
||||
<Grid Width="{Binding Width}" Height="{Binding Height}">
|
||||
<Rectangle Name="Border"
|
||||
StrokeThickness="1"
|
||||
StrokeDashArray="2"
|
||||
Fill="Transparent"
|
||||
SnapsToDevicePixels="true"/>
|
||||
<Viewbox Stretch="Fill">
|
||||
<Grid IsHitTestVisible="False">
|
||||
<ContentControl Style="{StaticResource CustomFlowNodeStyle}" Margin="2"/>
|
||||
<TextBlock Text="{Binding Text}" Margin="5" Foreground="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
<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">
|
||||
@@ -179,7 +179,7 @@
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type model:SFCToolBoxData}">
|
||||
<DataTemplate DataType="{x:Type sfcmodel:SFCToolBoxData}">
|
||||
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Kind,Converter={StaticResource EnumDescriptionConverter}}">
|
||||
<Rectangle Name="Border"
|
||||
StrokeThickness="1"
|
||||
@@ -187,7 +187,7 @@
|
||||
Fill="Transparent"
|
||||
SnapsToDevicePixels="true"/>
|
||||
<Grid IsHitTestVisible="False">
|
||||
<ContentControl Style="{StaticResource CustomSFCNodeStyle}" Margin="2" />
|
||||
<ContentControl Style="{StaticResource CustomSFCNodeStyle}" Margin="2" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
|
||||
Reference in New Issue
Block a user