mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-02 14:01:29 +08:00
mind
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner.Additionals\AIStudio.Wpf.DiagramDesigner.Additionals.csproj" />
|
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner.Additionals\AIStudio.Wpf.DiagramDesigner.Additionals.csproj" />
|
||||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner\AIStudio.Wpf.DiagramDesigner.csproj" />
|
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner\AIStudio.Wpf.DiagramDesigner.csproj" />
|
||||||
<ProjectReference Include="..\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
<ProjectReference Include="..\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
||||||
|
<ProjectReference Include="..\AIStudio.Wpf.Mind\AIStudio.Wpf.Mind.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo
|
|||||||
Children=new List<MenuItemViewModel>
|
Children=new List<MenuItemViewModel>
|
||||||
{
|
{
|
||||||
new MenuItemViewModel(){Title = "FlowchartEditor"},
|
new MenuItemViewModel(){Title = "FlowchartEditor"},
|
||||||
|
new MenuItemViewModel(){Title = "MindEditor"},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AIStudio.Wpf.Flowchart;
|
||||||
|
|
||||||
|
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
||||||
|
{
|
||||||
|
class MindEditorViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public MindEditorViewModel()
|
||||||
|
{
|
||||||
|
Title = "MindEditor";
|
||||||
|
Info = "Encapsulated mind controls";
|
||||||
|
|
||||||
|
GetDataCommand = new SimpleCommand(GetDataExcute);
|
||||||
|
SetDataCommand = new SimpleCommand(SetDataExcute);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Func<string> _getDataFunc;
|
||||||
|
public Func<string> GetDataFunc
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _getDataFunc;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _getDataFunc, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _inputData;
|
||||||
|
public string InputData
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _inputData;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _inputData, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _outputData;
|
||||||
|
public string OutputData
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _outputData;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _outputData, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _data = "{}";
|
||||||
|
public string Data
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _data;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _data, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SimpleCommand GetDataCommand
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleCommand SetDataCommand
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetDataExcute(object obj)
|
||||||
|
{
|
||||||
|
OutputData = GetDataFunc();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetDataExcute(object obj)
|
||||||
|
{
|
||||||
|
Data = "{}";
|
||||||
|
Data = InputData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
AIStudio.Wpf.DiagramDesigner.Demo/Views/MindEditorView.xaml
Normal file
49
AIStudio.Wpf.DiagramDesigner.Demo/Views/MindEditorView.xaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.MindEditorView"
|
||||||
|
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:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||||
|
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox Text="{Binding InputData}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
Height="50"/>
|
||||||
|
<Button Grid.Column="1" Content="加载数据" Command="{Binding SetDataCommand}"/>
|
||||||
|
<Button Grid.Column="2" Content="获取数据" Command="{Binding GetDataCommand}"/>
|
||||||
|
<TextBox Grid.Column="3" Text="{Binding OutputData}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
Height="50"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<dd:MindEditor Grid.Row="1" Data="{Binding Data}"
|
||||||
|
GetDataFunc="{Binding GetDataFunc,Mode=OneWayToSource}">
|
||||||
|
</dd:MindEditor>
|
||||||
|
|
||||||
|
<controls:TitleControl Grid.RowSpan="2"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MindEditorView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MindEditorView : UserControl
|
||||||
|
{
|
||||||
|
public MindEditorView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
this.ItemTypeName = viewmodel.GetType().FullName;
|
this.ItemTypeName = viewmodel.GetType().FullName;
|
||||||
this.Margin = viewmodel.Margin;
|
this.Margin = viewmodel.Margin;
|
||||||
this.Reserve = reserve;
|
this.Reserve = reserve;
|
||||||
|
this.CornerRadius = viewmodel.CornerRadius;
|
||||||
|
this.BorderThickness = viewmodel.BorderThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlAttribute("Left")]
|
[XmlAttribute("Left")]
|
||||||
@@ -102,6 +105,18 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public CornerRadius CornerRadius
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public Thickness BorderThickness
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
this.PhysicalItemWidth = designer.PhysicalItemWidth;
|
this.PhysicalItemWidth = designer.PhysicalItemWidth;
|
||||||
this.PhysicalItemHeight = designer.PhysicalItemHeight;
|
this.PhysicalItemHeight = designer.PhysicalItemHeight;
|
||||||
this.Icon = designer.Icon;
|
this.Icon = designer.Icon;
|
||||||
|
this.CornerRadius = designer.CornerRadius;
|
||||||
|
this.BorderThickness = designer.BorderThickness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,6 +475,32 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CornerRadius _cornerRadius = new CornerRadius(3);
|
||||||
|
public CornerRadius CornerRadius
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _cornerRadius;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _cornerRadius, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Thickness _borderThickness = new Thickness(1);
|
||||||
|
public Thickness BorderThickness
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _borderThickness;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _borderThickness, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 连接点是否可以按偏移自定义
|
/// 连接点是否可以按偏移自定义
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
<ProjectReference Include="..\AIStudio.Wpf.DiagramModels\AIStudio.Wpf.DiagramModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
44
AIStudio.Wpf.Mind/Controls/MindEditor.xaml
Normal file
44
AIStudio.Wpf.Mind/Controls/MindEditor.xaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="clr-namespace:AIStudio.Wpf.Mind.Controls"
|
||||||
|
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram">
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Themes/MindNode.xaml"/>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<Style x:Key="AIStudio.Styles.MindEditor" TargetType="{x:Type controls:MindEditor}">
|
||||||
|
<Setter Property="Focusable" Value="True"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type controls:MindEditor}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- ToolBox Control -->
|
||||||
|
<ContentControl Template="{Binding ToolBox,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
|
|
||||||
|
<ScrollViewer Grid.Column="1">
|
||||||
|
<!-- Diagram Control -->
|
||||||
|
<dd:DiagramControl x:Name="PART_DiagramControl" MinWidth="1000" MinHeight="1000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="AIStudio.Styles.MindEditor.Default" TargetType="{x:Type controls:MindEditor}" BasedOn="{StaticResource AIStudio.Styles.MindEditor}">
|
||||||
|
<Setter Property="ToolBox">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Control">
|
||||||
|
<controls:ToolBoxControl />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type controls:MindEditor}" BasedOn="{StaticResource AIStudio.Styles.MindEditor.Default}" />
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -159,6 +159,26 @@ namespace AIStudio.Wpf.Mind.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ToolBox
|
||||||
|
/// <summary>
|
||||||
|
/// 附加组件模板
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ToolBoxProperty = DependencyProperty.Register(
|
||||||
|
nameof(ToolBox), typeof(ControlTemplate), typeof(MindEditor), new FrameworkPropertyMetadata(default(ControlTemplate)));
|
||||||
|
|
||||||
|
public ControlTemplate ToolBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (ControlTemplate)GetValue(ToolBoxProperty);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(ToolBoxProperty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SelectedObject
|
#region SelectedObject
|
||||||
|
|
||||||
public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register(nameof(SelectedObject), typeof(object), typeof(MindEditor), new UIPropertyMetadata(default(object)));
|
public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register(nameof(SelectedObject), typeof(object), typeof(MindEditor), new UIPropertyMetadata(default(object)));
|
||||||
37
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
Normal file
37
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<UserControl x:Class="AIStudio.Wpf.Mind.Controls.ToolBoxControl"
|
||||||
|
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:AIStudio.Wpf.Mind.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800" >
|
||||||
|
<Grid Height="60">
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="思路">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="外观">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="视图">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml.cs
Normal file
26
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace AIStudio.Wpf.Mind.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ToolBoxControl.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ToolBoxControl : UserControl
|
||||||
|
{
|
||||||
|
public ToolBoxControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
84
AIStudio.Wpf.Mind/Models/MindNodeDesignerItem.cs
Normal file
84
AIStudio.Wpf.Mind/Models/MindNodeDesignerItem.cs
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using AIStudio.Wpf.DiagramDesigner;
|
||||||
|
using AIStudio.Wpf.Mind.ViewModels;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace AIStudio.Wpf.Mind.Models
|
||||||
|
{
|
||||||
|
public class MindNodeDesignerItem : DesignerItemBase
|
||||||
|
{
|
||||||
|
public MindNodeDesignerItem()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public MindNodeDesignerItem(MindNode item) : base(item)
|
||||||
|
{
|
||||||
|
NodeLevel = item.NodeLevel;
|
||||||
|
MindType = item.MindType;
|
||||||
|
Spacing = item.Spacing;
|
||||||
|
Offset = item.Offset;
|
||||||
|
IsExpanded = item.IsExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public NodeLevel NodeLevel
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public MindType MindType
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public Size Spacing
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[XmlAttribute("Spacing")]
|
||||||
|
public string XmlSpacing
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SerializeHelper.SerializeSize(Spacing);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Spacing = SerializeHelper.DeserializeSize(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public Point Offset
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[XmlAttribute("Offset")]
|
||||||
|
public string XmlOffset
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SerializeHelper.SerializePoint(Offset);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Offset = SerializeHelper.DeserializePoint(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public bool IsExpanded
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
AIStudio.Wpf.Mind/Models/MindNodeModel.cs
Normal file
51
AIStudio.Wpf.Mind/Models/MindNodeModel.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using AIStudio.Wpf.DiagramModels;
|
||||||
|
using AIStudio.Wpf.DiagramModels.ViewModels;
|
||||||
|
using AIStudio.Wpf.Mind;
|
||||||
|
using AIStudio.Wpf.Mind.ViewModels;
|
||||||
|
|
||||||
|
namespace AIStudio.Wpf.Flowchart.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class MindNodeModel : DiagramNode
|
||||||
|
{
|
||||||
|
public NodeLevel NodeLevel
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MindType MindType
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Size Spacing
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Point Offset
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsExpanded
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DiagramItemViewModel ToNodel()
|
||||||
|
{
|
||||||
|
MindNode mindNode = new MindNode(NodeLevel, MindType);
|
||||||
|
|
||||||
|
mindNode.Spacing = Spacing;
|
||||||
|
mindNode.Offset = Offset;
|
||||||
|
mindNode.IsExpanded = IsExpanded;
|
||||||
|
|
||||||
|
return mindNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
@@ -8,3 +9,9 @@ using System.Windows;
|
|||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
[assembly: XmlnsDefinition("https://gitee.com/akwkevin/aistudio.-wpf.-diagram", "AIStudio.Wpf.Mind")]
|
||||||
|
[assembly: XmlnsDefinition("https://gitee.com/akwkevin/aistudio.-wpf.-diagram", "AIStudio.Wpf.Mind.Controls")]
|
||||||
|
[assembly: XmlnsDefinition("https://gitee.com/akwkevin/aistudio.-wpf.-diagram", "AIStudio.Wpf.Mind.Controls")]
|
||||||
|
|
||||||
|
[assembly: XmlnsPrefix("https://gitee.com/akwkevin/aistudio.-wpf.-diagram", "dd")]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<!--<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Controls/FlowchartEditor.xaml"/>-->
|
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/MindEditor.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -8,16 +8,21 @@ using System.Text;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Linq;
|
||||||
using AIStudio.Wpf.DiagramDesigner;
|
using AIStudio.Wpf.DiagramDesigner;
|
||||||
using AIStudio.Wpf.DiagramDesigner.Algorithms;
|
using AIStudio.Wpf.DiagramDesigner.Algorithms;
|
||||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||||
using AIStudio.Wpf.DiagramDesigner.Helpers;
|
using AIStudio.Wpf.DiagramDesigner.Helpers;
|
||||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||||
|
using AIStudio.Wpf.DiagramModels;
|
||||||
|
using AIStudio.Wpf.DiagramModels.ViewModels;
|
||||||
|
using AIStudio.Wpf.Flowchart.Models;
|
||||||
using AIStudio.Wpf.Mind.Helpers;
|
using AIStudio.Wpf.Mind.Helpers;
|
||||||
|
using AIStudio.Wpf.Mind.Models;
|
||||||
|
|
||||||
namespace AIStudio.Wpf.Mind.ViewModels
|
namespace AIStudio.Wpf.Mind.ViewModels
|
||||||
{
|
{
|
||||||
public class MindNode : DesignerItemViewModelBase
|
public class MindNode : DiagramItemViewModel
|
||||||
{
|
{
|
||||||
public MindNode(NodeLevel nodeLevel, MindType mindType = MindType.Mind) : this(null, nodeLevel, mindType)
|
public MindNode(NodeLevel nodeLevel, MindType mindType = MindType.Mind) : this(null, nodeLevel, mindType)
|
||||||
{
|
{
|
||||||
@@ -42,6 +47,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
InitLayout();
|
InitLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override SelectableItemBase GetSerializableObject()
|
||||||
|
{
|
||||||
|
return new MindNodeDesignerItem(this);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Init(IDiagramViewModel root)
|
protected override void Init(IDiagramViewModel root)
|
||||||
{
|
{
|
||||||
base.Init(root);
|
base.Init(root);
|
||||||
@@ -65,6 +75,35 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
||||||
|
{
|
||||||
|
base.LoadDesignerItemViewModel(designerbase);
|
||||||
|
|
||||||
|
if (designerbase is MindNodeDesignerItem designer)
|
||||||
|
{
|
||||||
|
NodeLevel = designer.NodeLevel;
|
||||||
|
MindType = designer.MindType;
|
||||||
|
Spacing = designer.Spacing;
|
||||||
|
Offset = designer.Offset;
|
||||||
|
IsExpanded = designer.IsExpanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DiagramNode ToDiagram()
|
||||||
|
{
|
||||||
|
var mindNodeModel = new MindNodeModel();
|
||||||
|
|
||||||
|
mindNodeModel.NodeLevel = NodeLevel;
|
||||||
|
mindNodeModel.MindType = MindType;
|
||||||
|
mindNodeModel.Spacing = Spacing;
|
||||||
|
mindNodeModel.Offset = Offset;
|
||||||
|
mindNodeModel.IsExpanded = IsExpanded;
|
||||||
|
|
||||||
|
return mindNodeModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private bool Level_Enable(object obj)
|
private bool Level_Enable(object obj)
|
||||||
{
|
{
|
||||||
@@ -103,33 +142,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
{
|
{
|
||||||
SetProperty(ref _mindType, value);
|
SetProperty(ref _mindType, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CornerRadius _cornerRadius = new CornerRadius(3);
|
|
||||||
public CornerRadius CornerRadius
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _cornerRadius;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _cornerRadius, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Thickness _borderThickness = new Thickness(1);
|
|
||||||
public Thickness BorderThickness
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _borderThickness;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _borderThickness, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _isExpanded = true;
|
private bool _isExpanded = true;
|
||||||
public bool IsExpanded
|
public bool IsExpanded
|
||||||
|
|||||||
Reference in New Issue
Block a user