├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── Directory.Build.Props ├── Document ├── 1.png ├── 2.png ├── 3.png ├── 4.png └── logo.png ├── LICENSE ├── README.md ├── Solution └── WPF-Diagram.sln ├── Source ├── App │ ├── HeBianGu.Test.Diagram │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── AssemblyInfo.cs │ │ ├── HeBianGu.Test.Diagram.csproj │ │ ├── Images │ │ │ ├── 功率计.png │ │ │ ├── 开关矩阵.png │ │ │ ├── 电源.png │ │ │ └── 频谱分析仪.png │ │ ├── MainWindow.xaml │ │ └── MainWindow.xaml.cs │ └── HeBianGu.Test.DiagramNuget │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── AssemblyInfo.cs │ │ ├── HeBianGu.Test.DiagramNuget.csproj │ │ ├── Images │ │ ├── 功率计.png │ │ ├── 开关矩阵.png │ │ ├── 电源.png │ │ └── 频谱分析仪.png │ │ ├── MainWindow.xaml │ │ └── MainWindow.xaml.cs └── Control │ ├── HeBianGu.Diagram.DrawingBox │ ├── AssemblyInfo.cs │ ├── Command.Node.cs │ ├── Diagram.xaml │ ├── Diagram.xaml.cs │ ├── DiagramCommands.cs │ ├── DiagramEffectKey.cs │ ├── DiagramFlowableMode.cs │ ├── DiagramFlowableState.cs │ ├── DiagramFlowableZoomMode.cs │ ├── DisplayPortMode.cs │ ├── Extention.cs │ ├── Figure │ │ └── Square.cs │ ├── Graph1.dgml │ ├── GraphSource │ │ ├── GraphSource.cs │ │ ├── IDataSource.cs │ │ ├── IGraphSource.cs │ │ ├── Model │ │ │ ├── DefaultLinkData.cs │ │ │ ├── DefaultPort.cs │ │ │ ├── Socket.cs │ │ │ ├── Unit.cs │ │ │ └── Wire.cs │ │ ├── TreeGraphSource.cs │ │ ├── TypeTreeGraphSource.cs │ │ └── UnitGraphSource.cs │ ├── HeBianGu.Diagram.DrawingBox.csproj │ ├── Layer │ │ ├── Base │ │ │ └── Layer.cs │ │ ├── LinkLayer.cs │ │ └── NodeLayer.cs │ ├── Layout │ │ ├── Base │ │ │ ├── ILayout.cs │ │ │ └── Layout.cs │ │ ├── CircularLayout.cs │ │ ├── ForceDirectedLayout.cs │ │ ├── GridLayout.cs │ │ ├── LocationLayout.cs │ │ └── TreeLayout.cs │ ├── LinkDrawer │ │ ├── ArcLinkDrawer.cs │ │ ├── BezierLinkDrawer.cs │ │ ├── BrokenLinkDrawer.cs │ │ ├── LineLinkDrawer.cs │ │ └── LinkDrawer.cs │ ├── LinkMode.cs │ ├── NodeResizeAdorner.xaml │ ├── NodeResizeAdorner.xaml.cs │ ├── Part │ │ ├── Base │ │ │ └── Part.cs │ │ ├── Link.xaml │ │ ├── Link.xaml.cs │ │ ├── Node.xaml │ │ ├── Node.xaml.cs │ │ ├── Port.xaml │ │ ├── Port.xaml.cs │ │ ├── TreeNode.xaml │ │ └── TreeNode.xaml.cs │ ├── Provider │ │ ├── Adorner │ │ │ ├── AdornerBase.cs │ │ │ ├── BorderAdorner.cs │ │ │ ├── ControlTemplateAdorner.xaml │ │ │ ├── ControlTemplateAdorner.xaml.cs │ │ │ ├── DataTemplateAdorner.xaml │ │ │ ├── DataTemplateAdorner.xaml.cs │ │ │ ├── DragAdorner.cs │ │ │ ├── ErrorAdorner.cs │ │ │ ├── GridLineAdorner.cs │ │ │ ├── LineAdorner.cs │ │ │ ├── OverAdorner.cs │ │ │ ├── PresenterAdorner.cs │ │ │ ├── ResizeAdorner.xaml │ │ │ ├── ResizeAdorner.xaml.cs │ │ │ ├── ScrollAdorner.cs │ │ │ ├── SelectedAdorner.cs │ │ │ ├── SelectedControlTemplateAdorner.cs │ │ │ └── VisualCollectionAdornerBase.cs │ │ ├── Bindable.cs │ │ ├── BindableBase.cs │ │ ├── Cattach.Behaviors.cs │ │ ├── DisplayEnumConverter.cs │ │ ├── DisplayNameConverter.cs │ │ ├── Extension.Dispatcher.cs │ │ ├── Extension.Geometry.cs │ │ ├── Extension.Rect.cs │ │ ├── Extention.Element.cs │ │ ├── IDragAdorner.cs │ │ ├── IZoombox.cs │ │ ├── MarkupCommandBase.cs │ │ ├── RelayCommand.cs │ │ └── RoutedEventArgs.cs │ ├── Service.cs │ ├── Service │ │ ├── Bevavior │ │ │ ├── DiagramAdorner.cs │ │ │ ├── DiagramDropBehavior │ │ │ │ ├── DiagramDropBehavior.cs │ │ │ │ └── DiagramDropNodeBehavior.cs │ │ │ ├── DynimacLinkBehavior │ │ │ │ ├── DynimacLinkBehaviorBase.cs │ │ │ │ ├── DynimacLinkNodeBehavior.cs │ │ │ │ ├── DynimacLinkPortBehavior.cs │ │ │ │ └── PortLinkBehavior.cs │ │ │ ├── NodeAdorner.cs │ │ │ ├── NodeMouseDragBehavior.cs │ │ │ ├── NodeMouseOverBehavior.cs │ │ │ └── NodeSelectionBehavior.cs │ │ ├── DynamicLinkData.cs │ │ ├── FlowableResult.cs │ │ ├── FlowableResultState.cs │ │ ├── FlowableState.cs │ │ ├── IData.cs │ │ ├── IDropable.cs │ │ ├── IFlowable.cs │ │ ├── IFlowableLink.cs │ │ ├── IFlowableNode.cs │ │ ├── IFlowablePort.cs │ │ ├── IFlowableResult.cs │ │ ├── ILinkData.cs │ │ ├── ILinkDataCreator.cs │ │ ├── ILinkInitializer.cs │ │ ├── INodeData.cs │ │ ├── INoteDisplay.cs │ │ ├── IPortData.cs │ │ ├── IPortDataCreator.cs │ │ ├── ITemplate.cs │ │ └── PortType.cs │ ├── Themes │ │ ├── Default.xaml │ │ └── Generic.xaml │ └── obfuscar.xml │ ├── HeBianGu.Diagram.Presenter.Workflow │ ├── AssemblyInfo.cs │ ├── Commands │ │ └── Command.AddNode.cs │ ├── HeBianGu.Diagram.Presenter.Workflow.csproj │ ├── NodeData │ │ ├── CardNodeData.cs │ │ ├── CircleNodeData.cs │ │ ├── ContentNodeData.cs │ │ ├── CornerRadiusNodeData.cs │ │ ├── DelayNodeData.cs │ │ ├── DiamondNodeData.cs │ │ ├── FileNodeData.cs │ │ ├── HexagonNodeData.cs │ │ ├── InputNodeData.cs │ │ ├── LineRectNodeData.cs │ │ ├── OperationNodeData.cs │ │ ├── ParallelNodeData.cs │ │ ├── ParallelogramNodeData.cs │ │ ├── PillarNodeData.cs │ │ ├── PredefineNodeData.cs │ │ ├── RectNodeData.cs │ │ ├── ReferenceNodeData.cs │ │ ├── RunwayNodeData.cs │ │ ├── StoreInNodeData.cs │ │ ├── TransforNodeData.cs │ │ ├── WaveNodeData.cs │ │ ├── WhileNodeData.cs │ │ └── WorkflowNodeBase.cs │ ├── Themes │ │ └── Generic.xaml │ ├── Workflow │ │ ├── AuditWorkflow.cs │ │ ├── BusinessMarkWorkflow.cs │ │ ├── DataWorkflow.cs │ │ ├── EventWorkflow.cs │ │ ├── IDEFWorkflow.cs │ │ ├── LaneWorkflow.xaml │ │ ├── LaneWorkflow.xaml.cs │ │ ├── SDLWorkflow.cs │ │ ├── WorkWorkflow.cs │ │ ├── Workflow.xaml │ │ ├── Workflow.xaml.cs │ │ └── WorkflowBase.cs │ ├── WorkflowNodeAdorner.xaml │ └── WorkflowNodeAdorner.xaml.cs │ └── HeBianGu.Diagram.Presenter │ ├── AssemblyInfo.cs │ ├── Attribute │ ├── DiagramType.cs │ ├── NodeDisplayAttribute.cs │ └── NodeTypeAttribute.cs │ ├── Commands │ ├── Command.AddNode.cs │ └── Command.Node.cs │ ├── Converter │ └── Converter.Node.cs │ ├── Diagram │ └── AutoTest │ │ ├── AutoTestFlowableDiagramBase.cs │ │ ├── AutoTestReportViewPresenter.cs │ │ ├── AutoTestResult.cs │ │ ├── AutoTestResultPresenter.cs │ │ └── ats_dd_result.cs │ ├── DiagramBase.cs │ ├── DiagramFlowableDataSourceConverter.cs │ ├── FlowableDiagramBase.cs │ ├── HeBianGu.Diagram.Presenter.csproj │ ├── IDiagram.cs │ ├── IFlowableDiagram.cs │ ├── Presenter │ ├── Link │ │ ├── FlowableLinkData.cs │ │ ├── LinkData.cs │ │ ├── TextLinkData.xaml │ │ └── TextLinkData.xaml.cs │ ├── Node │ │ ├── Card │ │ │ ├── CardNodeData.xaml │ │ │ ├── CardNodeData.xaml.cs │ │ │ ├── CheckCardNodeData.xaml │ │ │ ├── CheckCardNodeData.xaml.cs │ │ │ ├── FlowableDiagramTemplateNodeData.xaml │ │ │ ├── FlowableDiagramTemplateNodeData.xaml.cs │ │ │ ├── LineCardNodeData.xaml │ │ │ ├── LineCardNodeData.xaml.cs │ │ │ ├── PointCardNodeData.xaml │ │ │ ├── PointCardNodeData.xaml.cs │ │ │ ├── TitleCardNodeData.xaml │ │ │ └── TitleCardNodeData.xaml.cs │ │ ├── FlowableNodeData.xaml │ │ ├── FlowableNodeData.xaml.cs │ │ ├── GeometryNodeData.xaml │ │ ├── GeometryNodeData.xaml.cs │ │ ├── ImageNodeData.xaml │ │ ├── ImageNodeData.xaml.cs │ │ ├── PropertyNodeData.cs │ │ ├── Provider │ │ │ ├── NodeData.cs │ │ │ ├── NodeFactory.cs │ │ │ └── SystemNodeData.cs │ │ ├── TextNodeData.xaml │ │ └── TextNodeData.xaml.cs │ └── Port │ │ ├── FlowablePortData.xaml │ │ ├── FlowablePortData.xaml.cs │ │ ├── PortData.cs │ │ ├── TextPortData.xaml │ │ └── TextPortData.xaml.cs │ ├── Provider │ ├── Behavior.Adorner.Base.cs │ ├── Behavior.Adorner.Loaded.cs │ ├── Cattach.cs │ ├── Converter.MarkupValueBase.cs │ ├── DiagramDataSourceConverter.cs │ ├── DiagramDropDispalyNodeBehavior.cs │ ├── DiagramKeys.cs │ ├── DiagramTemplate.cs │ ├── DiagramTheme.cs │ ├── DiagramThemeGroup.cs │ ├── DisplayBindableBase.cs │ ├── DisplayGraphSource.cs │ ├── DrapAdornerBehavior.cs │ ├── DropAdornerBehavior.cs │ ├── ElementAllowDrapBehavior.cs │ ├── Extension.Observable.cs │ ├── GeometryFactory.cs │ ├── IDefaultable.cs │ ├── IDiagramTemplate.cs │ ├── IDragAdorner.cs │ ├── IModelBindable.T.cs │ ├── IModelBindable.cs │ ├── ISearchable.cs │ ├── ISelectBindable.cs │ ├── ModelBindable.cs │ ├── NodeGroup.cs │ ├── SelectBindable.cs │ ├── Seriliaze │ │ ├── XmlDiagramData.cs │ │ └── XmlStringData.cs │ └── Tree │ │ ├── ITreeNode.cs │ │ ├── LinkTreeNode.cs │ │ ├── NodeTreeNode.cs │ │ ├── PartTreeNodeBase.cs │ │ ├── PortTreeNode.cs │ │ └── TreeNodeBase.cs │ ├── Service │ ├── Extention.cs │ ├── Service.cs │ └── Setting.cs │ └── Themes │ └── Generic.xaml ├── WPF-Package.sln └── settings.xamlstyler /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: NuGet Push 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build: 10 | runs-on: windows-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | - name: Setup 15 | uses: actions/setup-dotnet@v1 16 | - name: Pack 17 | run: dotnet build --configuration Release 18 | - name: Push 19 | run: dotnet nuget push .\Source\*\*\bin\Release\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NuGetAPIKey }} --skip-duplicate --no-symbols 1 20 | -------------------------------------------------------------------------------- /Directory.Build.Props: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | logo.png 5 | 7 | MIT 8 | net7.0-windows; 9 | False 10 | 9.0 11 | 1.0.0 12 | 1.0.0 13 | 1.0.0 14 | Copyright © HeBianGu 2024-2024 15 | HeBianGu 16 | https://github.com/HeBianGu/WPF-Diagram 17 | https://github.com/HeBianGu/WPF-Diagram 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | True 30 | \ 31 | 32 | 33 | -------------------------------------------------------------------------------- /Document/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Document/1.png -------------------------------------------------------------------------------- /Document/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Document/2.png -------------------------------------------------------------------------------- /Document/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Document/3.png -------------------------------------------------------------------------------- /Document/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Document/4.png -------------------------------------------------------------------------------- /Document/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Document/logo.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 HeBianGu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WPF-Diagram | [English](README.md) 2 | WPF流程图控件 3 |

4 | dotnet-version 5 |

6 | 7 |

8 | csharp-version 9 | IDE-version 10 |

11 | 12 |

13 | 14 | nuget-version 15 | 16 | 17 | Github-build-status 18 | 19 |

20 | 21 | ## 预览 22 | 23 | ![qrcode](https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/main/Document/1.png) 24 | ![qrcode](https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/main/Document/2.png) 25 | ![qrcode](https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/main/Document/3.png) 26 | ![qrcode](https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/main/Document/4.png) 27 | 28 | [演示视频](https://www.bilibili.com/video/BV1qy421i74b/?spm_id_from=333.999.0.0) 29 | 30 | ## 推荐学习官方文档 31 | https://learn.microsoft.com/zh-cn/dotnet/api/system.windows.controls?view=windowsdesktop-8.0?wt.mc_id=MVP_380318 32 | ## 推荐查看在线源码 33 | https://referencesource.microsoft.com/?wt.mc_id=MVP_380318 34 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace HeBianGu.Test.Diagram 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/HeBianGu.Test.Diagram.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/Images/功率计.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.Diagram/Images/功率计.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/Images/开关矩阵.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.Diagram/Images/开关矩阵.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/Images/电源.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.Diagram/Images/电源.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/Images/频谱分析仪.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.Diagram/Images/频谱分析仪.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.Diagram/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace HeBianGu.Test.Diagram 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace HeBianGu.Test.DiagramNuget 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/HeBianGu.Test.DiagramNuget.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/Images/功率计.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.DiagramNuget/Images/功率计.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/Images/开关矩阵.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.DiagramNuget/Images/开关矩阵.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/Images/电源.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.DiagramNuget/Images/电源.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/Images/频谱分析仪.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HeBianGu/WPF-Diagram/3d60284674ccdf48dfe21ea1f524bf12a8f9a72a/Source/App/HeBianGu.Test.DiagramNuget/Images/频谱分析仪.png -------------------------------------------------------------------------------- /Source/App/HeBianGu.Test.DiagramNuget/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace HeBianGu.Test.DiagramNuget 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows; 4 | using System.Windows.Markup; 5 | 6 | [assembly: ThemeInfo( 7 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 8 | //(used if a resource is not found in the page, 9 | // or application resource dictionaries) 10 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 11 | //(used if a resource is not found in the page, 12 | // app, or any theme specific resource dictionaries) 13 | )] 14 | 15 | [assembly: XmlnsDefinition("QQ:908293466", "HeBianGu.Diagram.DrawingBox")] 16 | [assembly: XmlnsPrefix("QQ:908293466", "h")] 17 | 18 | [assembly: XmlnsDefinition("https://github.com/HeBianGu", "HeBianGu.Diagram.DrawingBox")] 19 | [assembly: XmlnsPrefix("https://github.com/HeBianGu", "h")] 20 | 21 | [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "HeBianGu.Diagram.DrawingBox")] 22 | [assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "h")] 23 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Command.Node.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | 6 | using System.Windows.Controls; 7 | 8 | namespace HeBianGu.Diagram.DrawingBox 9 | { 10 | public class RemoveNodeCommand : MarkupCommandBase 11 | { 12 | public override void Execute(object parameter) 13 | { 14 | if (parameter is Node node) 15 | node.Delete(); 16 | 17 | if (parameter is ContextMenu menu) 18 | { 19 | menu.PlacementTarget.GetParent()?.Delete(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DiagramCommands.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | using System.Windows.Input; 6 | 7 | namespace HeBianGu.Diagram.DrawingBox 8 | { 9 | public static class DiagramCommands 10 | { 11 | public static RoutedUICommand Start = new RoutedUICommand() { Text = "开始流程" }; 12 | public static RoutedUICommand Stop = new RoutedUICommand() { Text = "停止流程" }; 13 | public static RoutedUICommand Reset = new RoutedUICommand() { Text = "重置流程" }; 14 | public static RoutedUICommand Clear = new RoutedUICommand() { Text = "清空节点" }; 15 | public static RoutedUICommand DeleteSelected = new RoutedUICommand() { Text = "删除选中" }; 16 | public static RoutedUICommand ZoomToFit = new RoutedUICommand() { Text = "缩放适配" }; 17 | public static RoutedUICommand Aligment = new RoutedUICommand() { Text = "自动布局" }; 18 | public static RoutedUICommand SelectAll = new RoutedUICommand() { Text = "全选" }; 19 | public static RoutedUICommand Next = new RoutedUICommand() { Text = "下一个" }; 20 | public static RoutedUICommand Previous = new RoutedUICommand() { Text = "上一个" }; 21 | 22 | public static RoutedUICommand MoveLeft = new RoutedUICommand() { Text = "左移动" }; 23 | public static RoutedUICommand MoveRight = new RoutedUICommand() { Text = "右移动" }; 24 | public static RoutedUICommand MoveUp = new RoutedUICommand() { Text = "上移动" }; 25 | public static RoutedUICommand MoveDown = new RoutedUICommand() { Text = "下移动" }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DiagramEffectKey.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | public class DiagramEffectKey 8 | { 9 | public static ComponentResourceKey IsDragEnter => new ComponentResourceKey(typeof(DiagramEffectKey), "S.EffectShadow.IsDragEnter"); 10 | public static ComponentResourceKey IsCanDrop => new ComponentResourceKey(typeof(DiagramEffectKey), "S.EffectShadow.IsCanDrop"); 11 | public static ComponentResourceKey IsSelected => new ComponentResourceKey(typeof(DiagramEffectKey), "S.EffectShadow.IsSelected"); 12 | public static ComponentResourceKey MouseOver => new ComponentResourceKey(typeof(DiagramEffectKey), "S.EffectShadow.MouseOver"); 13 | public static ComponentResourceKey IsDragging => new ComponentResourceKey(typeof(DiagramEffectKey), "S.EffectShadow.IsDragging"); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DiagramFlowableMode.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.DrawingBox 2 | { 3 | public enum DiagramFlowableMode 4 | { 5 | Node = 0, 6 | Link, 7 | Port 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DiagramFlowableState.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.DrawingBox 2 | { 3 | public enum DiagramFlowableState 4 | { 5 | None = 0, 6 | Running, 7 | Success, 8 | Error, 9 | Stopped, 10 | Canceling, 11 | Canceled 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DiagramFlowableZoomMode.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.DrawingBox 2 | { 3 | public enum DiagramFlowableZoomMode 4 | { 5 | None = 0, 6 | Rect, 7 | Center 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/DisplayPortMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | 6 | using System.ComponentModel; 7 | using System.ComponentModel.DataAnnotations; 8 | 9 | namespace HeBianGu.Diagram.DrawingBox 10 | { 11 | [TypeConverter(typeof(DisplayEnumConverter))] 12 | public enum DisplayPortMode 13 | { 14 | [Display(Name = "始终")] 15 | Always = 0, 16 | [Display(Name = "悬停")] 17 | MouseOver, 18 | [Display(Name = "选中")] 19 | Selected 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Extention.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace System 4 | { 5 | 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Figure/Square.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | using System.Windows.Media; 5 | 6 | namespace HeBianGu.Diagram.DrawingBox 7 | { 8 | public abstract class FigureBase : ICloneable 9 | { 10 | public FigureBase() 11 | { 12 | this.Name = this.GetType().Name; 13 | } 14 | public string Name { get; set; } 15 | 16 | public double Width { get; set; } = 100; 17 | 18 | public double Height { get; set; } = 100; 19 | 20 | public Brush Background { get; set; } = Brushes.Gray; 21 | 22 | public Brush Foreground { get; set; } = Brushes.White; 23 | 24 | public object Clone() 25 | { 26 | object n = Activator.CreateInstance(this.GetType()); 27 | 28 | System.Reflection.PropertyInfo[] ps = this.GetType().GetProperties(); 29 | 30 | foreach (System.Reflection.PropertyInfo p in ps) 31 | { 32 | p.SetValue(n, p.GetValue(this)); 33 | } 34 | 35 | return n; 36 | } 37 | } 38 | /// 正方形 39 | public class Square : FigureBase 40 | { 41 | } 42 | 43 | /// 44 | /// 菱形 45 | /// 46 | public class Diamond : FigureBase 47 | { 48 | } 49 | 50 | /// 51 | /// 三角形 52 | /// 53 | public class Trangle : FigureBase 54 | { 55 | 56 | } 57 | 58 | /// 59 | /// 圆形 60 | /// 61 | public class Circle : FigureBase 62 | { 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/GraphSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Collections.Generic; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | /// 8 | /// 子类用于重写 重写Node和Link跟数据源的转换方式 9 | /// 10 | /// 11 | /// 12 | public abstract class GraphSource : IGraphSource, IDataSource 13 | { 14 | public List NodeSource { get; private set; } = new List(); 15 | 16 | public GraphSource(List nodeSource) 17 | { 18 | this.NodeSource = nodeSource; 19 | } 20 | 21 | public GraphSource(IEnumerable nodes, IEnumerable links) 22 | { 23 | System.Windows.Application.Current.Dispatcher.Invoke(() => 24 | { 25 | foreach (NodeDataType unit in nodes) 26 | { 27 | Node n = this.ConvertToNode(unit); 28 | this.NodeSource.Add(n); 29 | } 30 | 31 | foreach (LinkDataType link in links) 32 | { 33 | this.ConvertToLink(link); 34 | } 35 | }); 36 | 37 | } 38 | 39 | /// 40 | /// 加载数据,由数据源到节点数据 41 | /// 42 | /// 43 | /// 44 | protected abstract Node ConvertToNode(NodeDataType node); 45 | 46 | /// 47 | /// 加载数据,由数据源到连线数据 48 | /// 49 | /// 50 | /// 51 | protected abstract Link ConvertToLink(LinkDataType node); 52 | 53 | public abstract List GetNodeType(); 54 | 55 | public abstract List GetLinkType(); 56 | } 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/IDataSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Collections.Generic; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | public interface IDataSource 8 | { 9 | List GetNodeType(); 10 | 11 | List GetLinkType(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/IGraphSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Collections.Generic; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | public interface IGraphSource 8 | { 9 | List NodeSource { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/Model/DefaultLinkData.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | 6 | 7 | namespace HeBianGu.Diagram.DrawingBox 8 | { 9 | /// 10 | /// 默认端口要显示的效果 11 | /// 12 | public class DefaultLinkData : Bindable, ILinkData 13 | { 14 | private string _message; 15 | /// 说明 16 | public string Message 17 | { 18 | get { return _message; } 19 | set 20 | { 21 | _message = value; 22 | RaisePropertyChanged("Message"); 23 | } 24 | } 25 | 26 | public string FromNodeID { get; set; } 27 | 28 | public string ToNodeID { get; set; } 29 | 30 | public string FromPortID { get; set; } 31 | 32 | public string ToPortID { get; set; } 33 | 34 | public void ApplayStyleTo(ILinkData node) 35 | { 36 | 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/Model/DefaultPort.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | namespace HeBianGu.Diagram.DrawingBox 8 | { 9 | /// 10 | /// 默认端口要显示的效果 11 | /// 12 | public class DefaultPortData : IPortData 13 | { 14 | public DefaultPortData() 15 | { 16 | 17 | } 18 | public DefaultPortData(string nodeID) 19 | { 20 | this.NodeID = nodeID; 21 | } 22 | 23 | public string ID { get; set; } = Guid.NewGuid().ToString(); 24 | 25 | public string NodeID { get; set; } 26 | 27 | public string Name { get; set; } 28 | 29 | 30 | public Dock Dock { get; set; } 31 | 32 | public PortType PortType { get; set; } 33 | 34 | public Thickness PortMargin { get; set; } = new Thickness(0, 0, 0, 0); 35 | 36 | public virtual void ApplayStyleTo(IPortData node) 37 | { 38 | 39 | } 40 | 41 | public bool CanDrop(Part part, out string message) 42 | { 43 | message = null; 44 | return false; 45 | } 46 | 47 | public ILinkData CreateLinkData() 48 | { 49 | return null; 50 | } 51 | 52 | public void InitLink(Link link) 53 | { 54 | 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/Model/Socket.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows.Controls; 4 | using System.Xml.Serialization; 5 | 6 | namespace HeBianGu.Diagram.DrawingBox 7 | { 8 | public class Socket 9 | { 10 | [XmlAttribute("Name")] 11 | public string Name { get; set; } 12 | 13 | [XmlAttribute("Dock")] 14 | public Dock Dock { get; set; } 15 | 16 | [XmlAttribute("Color")] 17 | public string Color { get; set; } 18 | 19 | [XmlAttribute("Index")] 20 | public int Index { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/Model/Unit.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Collections.Generic; 4 | using System.Xml.Serialization; 5 | 6 | namespace HeBianGu.Diagram.DrawingBox 7 | { 8 | public class Unit 9 | { 10 | [XmlAttribute("Id")] 11 | public string Id { get; set; } 12 | 13 | [XmlAttribute("X")] 14 | public double X { get; set; } 15 | 16 | [XmlAttribute("Y")] 17 | public double Y { get; set; } 18 | 19 | [XmlAttribute("Text")] 20 | public string Text { get; set; } 21 | 22 | public List Sockets { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/Model/Wire.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Xml.Serialization; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | public class Wire 8 | { 9 | [XmlAttribute("From")] 10 | public string From { get; set; } 11 | 12 | [XmlAttribute("To")] 13 | public string To { get; set; } 14 | 15 | [XmlAttribute("FromPort")] 16 | public string FromPort { get; set; } 17 | 18 | [XmlAttribute("ToPort")] 19 | public string ToPort { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/TreeGraphSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace HeBianGu.Diagram.DrawingBox 8 | { 9 | /// 10 | /// 自定义匹配方式的树结构数据源 11 | /// 12 | /// 13 | public class TreeGraphSource : IGraphSource 14 | { 15 | public List NodeSource { get; protected set; } = new List(); 16 | 17 | private Func _childFiter; 18 | private Predicate _rootFiter; 19 | 20 | public TreeGraphSource(List nodes, Func childFiter, Predicate rootFiter) 21 | { 22 | _childFiter = childFiter; 23 | _rootFiter = rootFiter; 24 | 25 | this.NodeSource = this.GetSource(nodes); 26 | } 27 | 28 | protected virtual List GetSource(List nodes) 29 | { 30 | 31 | List treeNodes = new List(); 32 | 33 | if (nodes == null) return treeNodes; 34 | 35 | NodeType obj = nodes.FirstOrDefault(l => _rootFiter(l)); 36 | 37 | TreeNode root = new TreeNode() { Content = obj }; 38 | 39 | Action action1 = null; 40 | 41 | action1 = (baseType, from) => 42 | { 43 | IEnumerable children = nodes.Where(l => _childFiter(l, baseType)); 44 | 45 | foreach (NodeType item in children) 46 | { 47 | TreeNode to = new TreeNode() { Content = item }; 48 | 49 | Link.Create(from, to); 50 | 51 | treeNodes.Add(to); 52 | 53 | action1(item, to); 54 | } 55 | }; 56 | 57 | treeNodes.Add(root); 58 | 59 | action1?.Invoke(obj, root); 60 | 61 | return treeNodes; 62 | } 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/TypeTreeGraphSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Reflection; 7 | 8 | namespace HeBianGu.Diagram.DrawingBox 9 | { 10 | /// 11 | /// 类型树结构数据源 12 | /// 13 | public class TypeTreeGraphSource : TreeGraphSource 14 | { 15 | /// 16 | /// 要构建Type树结构的程序集 17 | /// 18 | /// 19 | public TypeTreeGraphSource(Assembly assembly) : base(null, (child, parent) => child.BaseType == parent, l => l.BaseType == null) 20 | { 21 | List types = assembly.GetTypes()?.ToList(); 22 | 23 | types = types.Where(l => l.IsClass && l.IsPublic && !l.IsGenericType && !typeof(Attribute).IsAssignableFrom(l))?.ToList(); 24 | 25 | List result = this.Build(types); 26 | 27 | this.NodeSource = this.GetSource(result); 28 | 29 | } 30 | 31 | /// 32 | /// 要构建Type树结构的类型集合 33 | /// 34 | /// 35 | public TypeTreeGraphSource(List types) : base(null, (child, parent) => child.BaseType == parent, l => l.BaseType == null) 36 | { 37 | List result = this.Build(types); 38 | 39 | this.NodeSource = this.GetSource(result); 40 | } 41 | 42 | private List Build(List types) 43 | { 44 | HashSet result = new HashSet(); 45 | 46 | Action> action = null; 47 | 48 | action = t => 49 | { 50 | result.UnionWith(t); 51 | 52 | List child = t.Where(l => l.BaseType != null).Select(l => l.BaseType)?.ToList(); 53 | 54 | if (child.Count > 0) 55 | { 56 | action(child); 57 | } 58 | }; 59 | 60 | action?.Invoke(types); 61 | 62 | return result.ToList(); 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/GraphSource/UnitGraphSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace HeBianGu.Diagram.DrawingBox 7 | { 8 | /// 9 | /// 根据 Unit和Wire加载的数据源 10 | /// 11 | public class UnitGraphSource : GraphSource 12 | { 13 | public UnitGraphSource(List nodes, List links) : base(nodes, links) 14 | { 15 | 16 | } 17 | 18 | protected override Node ConvertToNode(Unit unit) 19 | { 20 | Node node = new Node() { Content = unit }; 21 | //node.Id = unit.Id; 22 | node.Location = new System.Windows.Point(unit.X, unit.Y); 23 | 24 | foreach (Socket socket in unit.Sockets) 25 | { 26 | Port port = Port.Create(node); 27 | //port.Id = socket.Name; 28 | port.Content = socket; 29 | port.Dock = socket.Dock; 30 | } 31 | 32 | return node; 33 | } 34 | 35 | protected override Link ConvertToLink(Wire wire) 36 | { 37 | Node fromNode = this.NodeSource.FirstOrDefault(l => l.Id == wire.From); 38 | Node toNode = this.NodeSource.FirstOrDefault(l => l.Id == wire.To); 39 | 40 | Port fromPort = fromNode.GetPorts(l => l.Id == wire.FromPort)?.FirstOrDefault(); 41 | Port toPort = fromNode.GetPorts(l => l.Id == wire.ToPort)?.FirstOrDefault(); 42 | 43 | return Link.Create(fromNode, toNode, fromPort, toPort); 44 | } 45 | 46 | public override List GetNodeType() 47 | { 48 | List result = new List(); 49 | 50 | foreach (Node node in this.NodeSource) 51 | { 52 | Unit unit = node.Content as Unit; 53 | 54 | IEnumerable sockets = node.GetPorts().Select(l => l.Content).Cast(); 55 | 56 | unit.Sockets = sockets.ToList(); 57 | 58 | result.Add(unit); 59 | } 60 | 61 | return result; 62 | } 63 | 64 | public override List GetLinkType() 65 | { 66 | List result = new List(); 67 | 68 | foreach (Node node in this.NodeSource) 69 | { 70 | foreach (Link link in node.LinksOutOf) 71 | { 72 | Wire wire = new Wire(); 73 | 74 | wire.From = link.FromNode?.Id; 75 | wire.To = link.ToNode?.Id; 76 | wire.FromPort = link.FromPort?.Id; 77 | wire.ToPort = link.ToPort?.Id; 78 | 79 | result.Add(wire); 80 | } 81 | } 82 | 83 | return result; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/HeBianGu.Diagram.DrawingBox.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layer/Base/Layer.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Input; 7 | 8 | namespace HeBianGu.Diagram.DrawingBox 9 | { 10 | public abstract class Layer : Panel 11 | { 12 | public string Id { get; set; } 13 | public bool UseAnimation 14 | { 15 | get { return (bool)GetValue(UseAnimationProperty); } 16 | set { SetValue(UseAnimationProperty, value); } 17 | } 18 | 19 | 20 | public static readonly DependencyProperty UseAnimationProperty = 21 | DependencyProperty.Register("UseAnimation", typeof(bool), typeof(Layer), new PropertyMetadata(true, (d, e) => 22 | { 23 | Layer control = d as Layer; 24 | 25 | if (control == null) return; 26 | 27 | //bool config = e.NewValue as bool; 28 | 29 | })); 30 | 31 | 32 | 33 | public TimeSpan Duration 34 | { 35 | get { return (TimeSpan)GetValue(DurationProperty); } 36 | set { SetValue(DurationProperty, value); } 37 | } 38 | 39 | 40 | public static readonly DependencyProperty DurationProperty = 41 | DependencyProperty.Register("Duration", typeof(TimeSpan), typeof(Layer), new PropertyMetadata(TimeSpan.FromMilliseconds(200), (d, e) => 42 | { 43 | Layer control = d as Layer; 44 | 45 | if (control == null) return; 46 | 47 | //TimeSpan config = e.NewValue as TimeSpan; 48 | 49 | })); 50 | 51 | 52 | protected override Size ArrangeOverride(Size arrangeSize) 53 | { 54 | this.UseAnimation = false; 55 | 56 | return arrangeSize; 57 | } 58 | 59 | 60 | protected override void OnMouseDown(MouseButtonEventArgs e) 61 | { 62 | base.OnMouseDown(e); 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layout/Base/ILayout.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace HeBianGu.Diagram.DrawingBox 4 | { 5 | public interface ILayout 6 | { 7 | Diagram Diagram { get; set; } 8 | void DoLayout(params Node[] nodes); 9 | void UpdateNode(params Node[] nodes); 10 | void RemoveNode(params Node[] nodes); 11 | void AddNode(params Node[] nodes); 12 | void DoLayoutLink(Link link); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layout/CircularLayout.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | using System.ComponentModel; 6 | using System.Windows; 7 | using System.Windows.Media; 8 | 9 | namespace HeBianGu.Diagram.DrawingBox 10 | { 11 | /// 圆形布局 12 | [DisplayName("CircularLayout")] 13 | [TypeConverter(typeof(DisplayNameConverter))] 14 | public class CircularLayout : Layout 15 | { 16 | public double Len { get; set; } = 200; 17 | 18 | public override void DoLayout(params Node[] nodes) 19 | { 20 | if (nodes == null) return; 21 | 22 | double height = this.Diagram.ActualHeight; 23 | 24 | double width = this.Diagram.ActualWidth; 25 | 26 | Point center = new Point(width / 2, height / 2); 27 | 28 | double span = 360.0 / nodes.Length; 29 | 30 | // Do :布局Node 31 | for (int i = 0; i < nodes.Length; i++) 32 | { 33 | Node node = nodes[i]; 34 | 35 | double angle = i * span; 36 | 37 | Point start = new Point(center.X - this.Len, center.Y); 38 | 39 | Matrix matrix = new Matrix(); 40 | 41 | matrix.RotateAt(angle, center.X, center.Y); 42 | 43 | Point end = matrix.Transform(start); 44 | 45 | // Do :设置节点 46 | NodeLayer.SetPosition(node, end); 47 | 48 | this.DoLayoutNode(node); 49 | 50 | this.DoLayoutPort(node); 51 | 52 | this.DoLayoutLink(node); 53 | 54 | 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layout/ForceDirectedLayout.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System; 4 | 5 | namespace HeBianGu.Diagram.DrawingBox 6 | { 7 | /// 关系布局 8 | public class ForceDirectedLayout : Layout 9 | { 10 | public override void DoLayout(params Node[] nodes) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layout/GridLayout.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Linq; 8 | 9 | namespace HeBianGu.Diagram.DrawingBox 10 | { 11 | /// 网格布局 12 | [DisplayName("GridLayout")] 13 | [TypeConverter(typeof(DisplayNameConverter))] 14 | public class GridLayout : Layout 15 | { 16 | public override void DoLayout(params Node[] nodes) 17 | { 18 | double height = this.Diagram.ActualHeight; 19 | 20 | List list = nodes.ToList(); 21 | 22 | //double space = 50.0; 23 | 24 | //double x = 0.0; 25 | 26 | for (int i = 0; i < list.Count(); i++) 27 | { 28 | Node item = list[i]; 29 | 30 | //if (item.VisualElement == null) continue; 31 | 32 | ////item.ApplyTemplate(); 33 | 34 | //var size = item.GetEffectiveSize(item.VisualElement); 35 | 36 | //item.Bounds = new Rect(new Point(x, height / 2), size); 37 | 38 | //x += size.Width + space; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Layout/LocationLayout.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | using System.ComponentModel; 6 | 7 | namespace HeBianGu.Diagram.DrawingBox 8 | { 9 | [DisplayName("LocationLayout")] 10 | [TypeConverter(typeof(DisplayNameConverter))] 11 | public class LocationLayout : Layout 12 | { 13 | /// 布局点和线 14 | public override void DoLayout(params Node[] nodes) 15 | { 16 | foreach (Node node in nodes) 17 | { 18 | // Do :布局Node 19 | NodeLayer.SetPosition(node, node.Location); 20 | } 21 | 22 | //this.UpdateNode(nodes); 23 | } 24 | 25 | public override void RemoveNode(params Node[] nodes) 26 | { 27 | foreach (Node node in nodes) 28 | { 29 | node.Delete(); 30 | } 31 | } 32 | 33 | public override void AddNode(params Node[] nodes) 34 | { 35 | this.DoLayout(nodes); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/LinkDrawer/LineLinkDrawer.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows; 4 | using System.Windows.Media; 5 | 6 | namespace HeBianGu.Diagram.DrawingBox 7 | { 8 | public class LineLinkDrawer : LinkDrawer 9 | { 10 | public LineLinkDrawer() 11 | { 12 | this.DisplayName = "直线"; 13 | } 14 | public override Geometry DrawPath(Link link, out Point center) 15 | { 16 | Point start = LinkLayer.GetStart(link); 17 | Point end = LinkLayer.GetEnd(link); 18 | Vector v = end - start; 19 | center = new Point((v.X / 2) + start.X, (v.Y / 2) + start.Y); 20 | if (this.IsLinkCrossBound == true) 21 | { 22 | Vector? find_start = Intersects(link.FromPort == null ? link.FromNode.Bound : link.FromPort.Bound, start, end); 23 | 24 | if (find_start.HasValue) 25 | { 26 | start = (Point)find_start.Value; 27 | } 28 | 29 | Vector? find_end = Intersects(link.ToPort == null ? link.ToNode.Bound : link.ToPort.Bound, start, end); 30 | if (find_end.HasValue) 31 | { 32 | end = (Point)find_end.Value; 33 | } 34 | } 35 | 36 | return this.GetLineGeometry(start.X, start.Y, end.X, end.Y); 37 | } 38 | 39 | protected Geometry GetLineGeometry(double x1, double y1, double x2, double y2) 40 | { 41 | Geometry geo = this.GetPolyLineGeometry(new Point(x1, y1), new Point(x2, y2)); 42 | if (!this.IsUseArrow) 43 | return geo; 44 | return this.GetArrowGeometry(geo, new Point(x1, y1), new Point(x2, y2)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/LinkMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | 5 | 6 | using System.ComponentModel; 7 | using System.ComponentModel.DataAnnotations; 8 | 9 | namespace HeBianGu.Diagram.DrawingBox 10 | { 11 | [TypeConverter(typeof(DisplayEnumConverter))] 12 | public enum LinkMode 13 | { 14 | [Display(Name = "节点")] 15 | Node = 0, 16 | [Display(Name = "端口")] 17 | Port 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/NodeResizeAdorner.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 33 | 34 | 35 | 36 | 39 | 41 | 47 | 48 | 49 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 67 | 72 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.DrawingBox/Part/TreeNode.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 62 | 63 | --> 47 | 48 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter.Workflow/WorkflowNodeAdorner.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | namespace HeBianGu.Diagram.Presenter.Workflow 8 | { 9 | public class WorkflowNodeAdorner : ControlTemplateAdorner 10 | { 11 | static WorkflowNodeAdorner() 12 | { 13 | DefaultStyleKeyProperty.OverrideMetadata(typeof(WorkflowNodeAdorner), new FrameworkPropertyMetadata(typeof(WorkflowNodeAdorner))); 14 | } 15 | 16 | public WorkflowNodeAdorner(UIElement adornedElement) : base(adornedElement) 17 | { 18 | 19 | } 20 | 21 | protected override ControlTemplate CreateTemplate() 22 | { 23 | return WorkflowNodeAdorner.GetTemplate(this.AdornedElement); 24 | } 25 | 26 | 27 | public static new ControlTemplate GetTemplate(DependencyObject obj) 28 | { 29 | return (ControlTemplate)obj.GetValue(TemplateProperty); 30 | } 31 | 32 | public static new void SetTemplate(DependencyObject obj, ControlTemplate value) 33 | { 34 | obj.SetValue(TemplateProperty, value); 35 | } 36 | 37 | 38 | public static new readonly DependencyProperty TemplateProperty = 39 | DependencyProperty.RegisterAttached("Template", typeof(ControlTemplate), typeof(WorkflowNodeAdorner), new PropertyMetadata(default(ControlTemplate), OnTemplateChanged)); 40 | 41 | public static new void OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 42 | { 43 | DependencyObject control = d; 44 | 45 | ControlTemplate n = (ControlTemplate)e.NewValue; 46 | 47 | ControlTemplate o = (ControlTemplate)e.OldValue; 48 | } 49 | 50 | 51 | 52 | //protected override ControlTemplate CreateTemplate() 53 | //{ 54 | // return WorkflowNodeAdorner.GetTemplate(this.AdornedElement) as ControlTemplate; 55 | //} 56 | 57 | //protected override void OnRender(DrawingContext drawingContext) 58 | //{ 59 | // //this._contentControl.Content = 2222; 60 | // this._contentControl.Template = this.Template; 61 | // this._contentControl.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); 62 | // Point point = new Point(); 63 | // point.X = (this.RenderSize.Width - this._contentControl.DesiredSize.Width) / 2; 64 | // point.Y = (this.RenderSize.Height - this._contentControl.DesiredSize.Height) / 2; 65 | // this._contentControl.Arrange(new Rect(point,this._contentControl.DesiredSize)); 66 | //} 67 | 68 | protected override Size MeasureOverride(Size constraint) 69 | { 70 | base.MeasureOverride(constraint); 71 | return this.AdornedElement.DesiredSize; 72 | } 73 | 74 | protected override Size ArrangeOverride(Size finalSize) 75 | { 76 | base.ArrangeOverride(finalSize); 77 | this._contentControl.Arrange(new Rect(new Point(0, 0), this.AdornedElement.DesiredSize)); 78 | return finalSize; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright ? 2022 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows; 4 | using System.Windows.Markup; 5 | 6 | [assembly: ThemeInfo( 7 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 8 | //(used if a resource is not found in the page, 9 | // or application resource dictionaries) 10 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 11 | //(used if a resource is not found in the page, 12 | // app, or any theme specific resource dictionaries) 13 | )] 14 | 15 | [assembly: XmlnsDefinition("QQ:908293466", "HeBianGu.Diagram.Presenter")] 16 | [assembly: XmlnsPrefix("QQ:908293466", "h")] 17 | 18 | [assembly: XmlnsDefinition("https://github.com/HeBianGu", "HeBianGu.Diagram.Presenter")] 19 | [assembly: XmlnsPrefix("https://github.com/HeBianGu", "h")] 20 | 21 | 22 | [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "HeBianGu.Diagram.Presenter")] 23 | [assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "h")] 24 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Attribute/DiagramType.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | //public enum DiagramType 4 | //{ 5 | // Workflow, AuditWorkflow, Lane 6 | //} 7 | } 8 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Attribute/NodeDisplayAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | //[System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 4 | //public class NodeDisplayAttribute : Attribute 5 | //{ 6 | // public string Name { get; set; } 7 | 8 | // public string GroupName { get; set; } 9 | 10 | // public int Order { get; set; } 11 | 12 | // public string Description { get; set; } 13 | //} 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Attribute/NodeTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | [System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] 6 | public class NodeTypeAttribute : Attribute 7 | { 8 | public Type DiagramType { get; set; } 9 | public string GroupType { get; set; } 10 | public int GroupColumns { get; set; } = 4; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Commands/Command.Node.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | using HeBianGu.Diagram.DrawingBox; 6 | using System.Linq; 7 | using System.Windows.Controls; 8 | 9 | namespace HeBianGu.Diagram.Presenter 10 | { 11 | public class ApplayStyleCommand : MarkupCommandBase 12 | { 13 | public bool UseApplayToAll { get; set; } 14 | 15 | public override void Execute(object parameter) 16 | { 17 | if (parameter is ContextMenu menu) 18 | { 19 | Node node = menu.PlacementTarget.GetParent(); 20 | HeBianGu.Diagram.DrawingBox.Diagram diagram = node.GetParent(); 21 | if (node.Content is NodeData data) 22 | { 23 | if (UseApplayToAll) 24 | { 25 | diagram.Nodes.ForEach(x => 26 | { 27 | if (x.Content is NodeData nodeData) 28 | data.ApplayStyleTo(nodeData); 29 | }); 30 | } 31 | else 32 | { 33 | System.Collections.Generic.IEnumerable finds = diagram.Nodes.Select(x => x.Content).OfType().Where(x => x.GetType().IsAssignableFrom(data.GetType())); 34 | 35 | foreach (NodeData item in finds) 36 | { 37 | data.ApplayStyleTo(item); 38 | } 39 | } 40 | 41 | } 42 | } 43 | 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Converter/Converter.Node.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Diagram/AutoTest/AutoTestReportViewPresenter.cs: -------------------------------------------------------------------------------- 1 |  2 | //using H.Controls.Chart2D; 3 | // 4 | 5 | 6 | //using System; 7 | //using System.ComponentModel; 8 | //using System.Linq; 9 | //using System.Xml.Serialization; 10 | 11 | //namespace HeBianGu.Diagram.Presenter 12 | //{ 13 | // public class AutoTestReportViewPresenter : BindableBase 14 | // { 15 | // private int _days = 30; 16 | // public int Days 17 | // { 18 | // get { return _days; } 19 | // set 20 | // { 21 | // _days = value; 22 | // RaisePropertyChanged(); 23 | // } 24 | // } 25 | 26 | // public AutoTestReportViewPresenter() 27 | // { 28 | // Random random = new Random(); 29 | // { 30 | 31 | // PointData seriesData = new PointData(); 32 | // for (int i = 0; i <= this.Days; i++) 33 | // { 34 | // DateTime current = DateTime.Now.AddDays(i - this.Days).Date; 35 | // this.LoginData.xAxis.Add(i - this.Days); 36 | // this.LoginData.xDisplay.Add(current.ToString("dd")); 37 | // seriesData.xDatas.Add(i - this.Days); 38 | // seriesData.yDatas.Add(random.NextDouble() * 100); 39 | // } 40 | // this.LoginData.SeriesDatas.Add(seriesData); 41 | // this.LoginData.BuildyAxis(0, 100); 42 | // } 43 | 44 | // { 45 | // System.Collections.Generic.IEnumerable> data = Enumerable.Range(0, 2).Select(x => Tuple.Create(random.NextDouble() * 100, x == 0 ? "合格" : "不合格")); 46 | // DoubleData seriesData = new DoubleData(); 47 | // seriesData.Build(data); 48 | // this.UserData.SeriesDatas.Add(seriesData); 49 | // this.UserData.SeriesDatas = this.UserData.SeriesDatas.ToObservable(); 50 | // } 51 | // } 52 | // //private ChartData _loginData = new ChartData(); 53 | // //[Browsable(false)] 54 | // //[XmlIgnore] 55 | // //public ChartData LoginData 56 | // //{ 57 | // // get { return _loginData; } 58 | // // set 59 | // // { 60 | // // _loginData = value; 61 | // // RaisePropertyChanged(); 62 | // // } 63 | // //} 64 | 65 | // //private ChartData _userData = new ChartData(); 66 | // //[Browsable(false)] 67 | // //[XmlIgnore] 68 | // //public ChartData UserData 69 | // //{ 70 | // // get { return _userData; } 71 | // // set 72 | // // { 73 | // // _userData = value; 74 | // // RaisePropertyChanged(); 75 | // // } 76 | // //} 77 | // } 78 | //} 79 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Diagram/AutoTest/AutoTestResult.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | //public class AutoTestResult : SelectBindable 7 | //{ 8 | // public AutoTestResult() : base(new ats_dd_result()) 9 | // { 10 | 11 | // } 12 | // public AutoTestResult(ats_dd_result model) : base(model) 13 | // { 14 | 15 | // } 16 | 17 | // private IDiagram _diagram; 18 | // /// 说明 19 | // public IDiagram Diagram 20 | // { 21 | // get { return _diagram; } 22 | // set 23 | // { 24 | // _diagram = value; 25 | // RaisePropertyChanged(); 26 | // } 27 | // } 28 | 29 | //} 30 | } 31 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Diagram/AutoTest/AutoTestResultPresenter.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | //public class AutoTestResultPresenter : RepositoryPropertyChangedPresenter 4 | //{ 5 | // private IDiagram _diagram; 6 | // /// 说明 7 | // public IDiagram Diagram 8 | // { 9 | // get { return _diagram; } 10 | // set 11 | // { 12 | // _diagram = value; 13 | // RaisePropertyChanged(); 14 | // } 15 | // } 16 | 17 | // public AutoTestResultPresenter(IDiagram diagram) 18 | // { 19 | // this.Diagram = diagram; 20 | // this.UseAdd = false; 21 | // this.UseEdit = false; 22 | 23 | // } 24 | // protected override async Task View(object obj) 25 | // { 26 | // if (obj is ats_dd_result model) 27 | // { 28 | // AutoTestResult result = new AutoTestResult(model); 29 | // result.Diagram = DiagramBase.CreateFromXml(model.Diagram, Diagram.GetType()); 30 | // await IocMessage.Presenter.ShowClose(result, null, model.BatchCode, x => 31 | // { 32 | // x.Margin = new Thickness(20); 33 | // x.Padding = new Thickness(20); 34 | // }); 35 | // } 36 | // } 37 | //} 38 | } 39 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Diagram/AutoTest/ats_dd_result.cs: -------------------------------------------------------------------------------- 1 |  2 | //using H.Providers.Ioc; 3 | //using System; 4 | //using System.ComponentModel; 5 | //using System.ComponentModel.DataAnnotations; 6 | 7 | //namespace HeBianGu.Diagram.Presenter 8 | //{ 9 | // public class ats_dd_result : DbModelBase 10 | // { 11 | // [Display(Name = "批次号")] 12 | // public string BatchCode { get; set; } = DateTime.Now.ToString("yyyyMMddHHmmssfff"); 13 | 14 | // [Display(Name = "日期")] 15 | // public DateTime Time { get; set; } = DateTime.Now; 16 | 17 | // [Browsable(false)] 18 | // [Display(Name = "预览图")] 19 | // public string Image { get; set; } 20 | 21 | // [Browsable(false)] 22 | // [Display(Name = "详情数据")] 23 | // public string Diagram { get; set; } 24 | 25 | // [Display(Name = "测量结果")] 26 | // public string Result { get; set; } 27 | 28 | // [Display(Name = "不良描述")] 29 | // public string Description { get; set; } 30 | 31 | // [Display(Name = "备注")] 32 | // public string Mark { get; set; } 33 | 34 | // [Display(Name = "操作员")] 35 | // public string User { get; set; } 36 | // } 37 | //} 38 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/DiagramFlowableDataSourceConverter.cs: -------------------------------------------------------------------------------- 1 | using HeBianGu.Diagram.DrawingBox; 2 | using System.Collections.Generic; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public class DiagramFlowableDataSourceConverter : DiagramDataSourceConverter 7 | { 8 | public DiagramFlowableDataSourceConverter(List nodeSource) : base(nodeSource) 9 | { 10 | } 11 | 12 | public DiagramFlowableDataSourceConverter(IEnumerable nodes, IEnumerable links) : base(nodes, links) 13 | { 14 | 15 | } 16 | 17 | protected override ILinkData CreateLinkData() 18 | { 19 | return new FlowableLinkData(); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/HeBianGu.Diagram.Presenter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/IDiagram.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | using System; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace HeBianGu.Diagram.Presenter 8 | { 9 | public interface IDiagram : ICloneable 10 | { 11 | string ID { get; set; } 12 | string Name { get; set; } 13 | string GroupName { get; set; } 14 | string TypeName { get; set; } 15 | //string TabName { get; set; } 16 | Part SelectedPart { get; set; } 17 | void ZoomAll(); 18 | void RefreshRoot(); 19 | ObservableCollection NodeGroups { get; set; } 20 | void Clear(); 21 | ObservableCollection DiagramThemeGroups { get; set; } 22 | ObservableCollection ReferenceTemplateNodeDatas { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/IFlowableDiagram.cs: -------------------------------------------------------------------------------- 1 | using HeBianGu.Diagram.DrawingBox; 2 | using System.Threading.Tasks; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public interface IFlowableDiagram : IDiagram 7 | { 8 | DiagramFlowableMode StartMode { get; set; } 9 | DiagramFlowableState State { get; set; } 10 | string Message { get; set; } 11 | Task Start(); 12 | Task Start(Node startNode); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/CardNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public class CardNodeData : FlowableNodeData 7 | { 8 | private double _cornerRadius; 9 | [DefaultValue(4)] 10 | [Display(Name = "圆角", GroupName = "样式")] 11 | public double CornerRadius 12 | { 13 | get { return _cornerRadius; } 14 | set 15 | { 16 | _cornerRadius = value; 17 | RaisePropertyChanged(); 18 | } 19 | } 20 | 21 | public override void LoadDefault() 22 | { 23 | base.LoadDefault(); 24 | this.Width = 180; 25 | this.Height = 60; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/CheckCardNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | public class CheckCardNodeData : CardNodeData 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/FlowableDiagramTemplateNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 |  2 | using HeBianGu.Diagram.DrawingBox; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Threading.Tasks; 5 | using System.Xml.Serialization; 6 | 7 | namespace HeBianGu.Diagram.Presenter 8 | { 9 | [Display(Name = "基本流程图", GroupName = "流程图", Order = 0)] 10 | public class FlowableDiagramTemplateNodeData : TitleCardNodeData 11 | { 12 | public FlowableDiagramTemplateNodeData() 13 | { 14 | this.Title = "模板"; 15 | } 16 | public FlowableDiagramTemplateNodeData(DiagramTemplate template) : this() 17 | { 18 | this.Template = template; 19 | this.Text = template.Name; 20 | this.Name = template.Name; 21 | this.FilePath = template.FilePath; 22 | } 23 | 24 | private DiagramTemplate _template; 25 | [XmlIgnore] 26 | public DiagramTemplate Template 27 | { 28 | get { return _template; } 29 | set 30 | { 31 | _template = value; 32 | RaisePropertyChanged(); 33 | } 34 | } 35 | 36 | private string _filePath; 37 | [XmlIgnore] 38 | public string FilePath 39 | { 40 | get { return _filePath; } 41 | set 42 | { 43 | _filePath = value; 44 | RaisePropertyChanged(); 45 | } 46 | } 47 | 48 | 49 | [XmlIgnore] 50 | [Display(Name = "查看模板", GroupName = "操作")] 51 | public RelayCommand ShowTemplateCommand => new RelayCommand(async (s, e) => 52 | { 53 | // await IocMessage.Dialog.Show(this.Template, null, this.Name, x => 54 | // { 55 | // x.HorizontalAlignment = HorizontalAlignment.Stretch; 56 | // x.VerticalAlignment = VerticalAlignment.Stretch; 57 | // x.Margin = new Thickness(20); 58 | // x.Padding = new Thickness(20); 59 | // }); 60 | }); 61 | 62 | public override async Task InvokeAsync(Part previors, Node current) 63 | { 64 | if (this.Template.Diagram is IFlowableDiagram flowable) 65 | { 66 | bool? r = await flowable.Start(); 67 | this.Message = flowable.Message; 68 | return r == true ? this.OK(flowable.Message) : this.Error(flowable.Message); 69 | } 70 | 71 | return this.Error("没有找到对应流程信息"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/LineCardNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public class LineCardNodeData : CardNodeData 7 | { 8 | private bool _useLeft; 9 | [DefaultValue(true)] 10 | [Display(Name = "启用左侧", GroupName = "样式")] 11 | public bool UseLeft 12 | { 13 | get { return _useLeft; } 14 | set 15 | { 16 | _useLeft = value; 17 | RaisePropertyChanged(); 18 | } 19 | } 20 | 21 | 22 | private bool _useRight; 23 | [DefaultValue(false)] 24 | [Display(Name = "启用右侧侧", GroupName = "样式")] 25 | public bool UseRight 26 | { 27 | get { return _useRight; } 28 | set 29 | { 30 | _useRight = value; 31 | RaisePropertyChanged(); 32 | } 33 | } 34 | 35 | private double _flagLength; 36 | [DefaultValue(10)] 37 | [Display(Name = "标签宽度", GroupName = "样式")] 38 | public double FlagLength 39 | { 40 | get { return _flagLength; } 41 | set 42 | { 43 | _flagLength = value; 44 | RaisePropertyChanged(); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/PointCardNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public class PointCardNodeData : CardNodeData 7 | { 8 | private double _flagLength; 9 | [DefaultValue(10)] 10 | [Display(Name = "标签宽度", GroupName = "样式")] 11 | public double FlagLength 12 | { 13 | get { return _flagLength; } 14 | set 15 | { 16 | _flagLength = value; 17 | RaisePropertyChanged(); 18 | } 19 | } 20 | 21 | public override void LoadDefault() 22 | { 23 | base.LoadDefault(); 24 | this.FlagLength = 15; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Card/TitleCardNodeData.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Windows.Media; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public class TitleCardNodeData : CardNodeData 8 | { 9 | public TitleCardNodeData() 10 | { 11 | this.Icon = "\xe7db"; 12 | } 13 | private string _title; 14 | [Display(Name = "标题", GroupName = "样式")] 15 | public string Title 16 | { 17 | get { return _title; } 18 | set 19 | { 20 | _title = value; 21 | RaisePropertyChanged(); 22 | } 23 | } 24 | 25 | 26 | private Brush _titleForeground; 27 | [DefaultValue(null)] 28 | [Display(Name = "标题颜色", GroupName = "样式")] 29 | public Brush TitleForeground 30 | { 31 | get { return _titleForeground; } 32 | set 33 | { 34 | _titleForeground = value; 35 | RaisePropertyChanged(); 36 | } 37 | } 38 | 39 | } 40 | 41 | public class EndCardNodeData : TitleCardNodeData 42 | { 43 | public EndCardNodeData() 44 | { 45 | this.Title = "结束节点"; 46 | this.Icon = "\xe842"; 47 | } 48 | 49 | public override void LoadDefault() 50 | { 51 | base.LoadDefault(); 52 | //this.TitleForeground = Application.Current.FindResource(BrushKeys.Orange) as Brush; 53 | } 54 | } 55 | 56 | public class StartCardNodeData : TitleCardNodeData 57 | { 58 | public StartCardNodeData() 59 | { 60 | this.UseStart = true; 61 | this.Title = "开始节点"; 62 | this.Icon = "\xe843"; 63 | } 64 | 65 | public override void LoadDefault() 66 | { 67 | base.LoadDefault(); 68 | //this.TitleForeground = Application.Current.FindResource(BrushKeys.Orange) as Brush; 69 | } 70 | } 71 | 72 | public class MessageCardNodeData : TitleCardNodeData 73 | { 74 | public MessageCardNodeData() 75 | { 76 | this.Icon = "\xe737"; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/PropertyNodeData.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | public class PropertyNodeData : FlowableNodeData 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Provider/NodeFactory.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel.DataAnnotations; 7 | using System.Linq; 8 | using System.Reflection; 9 | 10 | namespace HeBianGu.Diagram.Presenter 11 | { 12 | public static class NodeFactory 13 | { 14 | public static IEnumerable LoadGeometryNodeDatas(params Type[] type) 15 | { 16 | IEnumerable types = Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(TextNodeData).IsAssignableFrom(t)).Where(x => !x.IsAbstract); 17 | 18 | foreach (Type item in types) 19 | { 20 | TextNodeData result = Activator.CreateInstance(item) as TextNodeData; 21 | if (type == null) 22 | yield return result; 23 | IEnumerable nodeTypes = item.GetCustomAttributes(); 24 | NodeTypeAttribute nodeType = nodeTypes?.FirstOrDefault(l => type.Any(x => x == l.DiagramType)); 25 | if (nodeType == null) 26 | continue; 27 | DisplayAttribute displayer = item.GetCustomAttribute(); 28 | result.Name = displayer?.Name; 29 | result.Description = displayer?.Description; 30 | result.GroupName = displayer?.GroupName; 31 | yield return result; 32 | } 33 | } 34 | 35 | public static IEnumerable LoadIconNodeDatas(params Type[] type) 36 | { 37 | //var fields = typeof(IconAll).GetFields(); 38 | //foreach (var field in fields) 39 | //{ 40 | // var v = field.GetValue(null); 41 | // yield return new SymbolNodeData() { Icon = v?.ToString(), GroupName = "全部符号" }; 42 | //} 43 | return null; 44 | } 45 | 46 | public static IEnumerable GetNodeGroups(this IEnumerable nodeDatas) 47 | { 48 | IEnumerable> groups = nodeDatas.GroupBy(l => l.GroupName); 49 | foreach (IGrouping group in groups) 50 | { 51 | NodeGroup nodeGroup = new NodeGroup(); 52 | nodeGroup.Name = group.Key; 53 | nodeGroup.AddRange(group); 54 | yield return nodeGroup; 55 | } 56 | } 57 | 58 | public static IEnumerable GetNodeGroups(params Type[] type) 59 | { 60 | IEnumerable groups1 = LoadGeometryNodeDatas(type).OfType().GetNodeGroups(); 61 | 62 | IEnumerable groups2 = LoadIconNodeDatas(type).OfType().Take(10).GetNodeGroups(); 63 | 64 | return groups1.Union(groups2); 65 | } 66 | 67 | //public static IEnumerable GetSymbolNodeGroups(params Type[] type) 68 | //{ 69 | // return LoadIconNodeDatas().OfType().Take(20).GetNodeGroups(); 70 | //} 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/Provider/SystemNodeData.cs: -------------------------------------------------------------------------------- 1 |  2 | using HeBianGu.Diagram.DrawingBox; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Windows.Controls; 6 | 7 | namespace HeBianGu.Diagram.Presenter 8 | { 9 | public interface ISystemNodeData : INodeData 10 | { 11 | public List PortDatas { get; set; } 12 | } 13 | 14 | public abstract class SystemNodeData : NodeData, ISystemNodeData 15 | { 16 | //[XmlIgnore] 17 | [Browsable(false)] 18 | public List PortDatas { get; set; } = new List(); 19 | 20 | protected override void InitPort() 21 | { 22 | this.PortDatas.Clear(); 23 | { 24 | IPortData port = CreatePortData(); 25 | port.Dock = Dock.Left; 26 | port.PortType = PortType.Both; 27 | PortDatas.Add(port); 28 | } 29 | 30 | { 31 | IPortData port = CreatePortData(); 32 | port.Dock = Dock.Right; 33 | port.PortType = PortType.Both; 34 | PortDatas.Add(port); 35 | } 36 | 37 | { 38 | IPortData port = CreatePortData(); 39 | port.Dock = Dock.Top; 40 | port.PortType = PortType.Both; 41 | PortDatas.Add(port); 42 | } 43 | 44 | { 45 | IPortData port = CreatePortData(); 46 | port.Dock = Dock.Bottom; 47 | port.PortType = PortType.Both; 48 | PortDatas.Add(port); 49 | } 50 | } 51 | 52 | public override object Clone() 53 | { 54 | SystemNodeData data = base.Clone() as SystemNodeData; 55 | data.PortDatas.Clear(); 56 | data.InitPort(); 57 | return data; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Presenter/Node/TextNodeData.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 9 | 12 | 20 | 21 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Behavior.Adorner.Base.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | using Microsoft.Xaml.Behaviors; 5 | using System; 6 | #if NET 7 | #endif 8 | using System.Windows; 9 | using System.Windows.Media; 10 | 11 | namespace HeBianGu.Diagram.Presenter 12 | { 13 | public abstract class AdornerBehaviorBase : Behavior 14 | { 15 | public Type AdornerType 16 | { 17 | get { return (Type)GetValue(AdornerTypeProperty); } 18 | set { SetValue(AdornerTypeProperty, value); } 19 | } 20 | 21 | public static readonly DependencyProperty AdornerTypeProperty = 22 | DependencyProperty.Register("AdornerType", typeof(Type), typeof(AdornerBehaviorBase), new PropertyMetadata(default(Type), (d, e) => 23 | { 24 | AdornerBehaviorBase control = d as AdornerBehaviorBase; 25 | 26 | if (control == null) return; 27 | 28 | Type config = e.NewValue as Type; 29 | 30 | })); 31 | 32 | 33 | public Visual AdornerVisual 34 | { 35 | get { return (Visual)GetValue(AdornerVisualProperty); } 36 | set { SetValue(AdornerVisualProperty, value); } 37 | } 38 | 39 | 40 | public static readonly DependencyProperty AdornerVisualProperty = 41 | DependencyProperty.Register("AdornerVisual", typeof(Visual), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(default(Visual), (d, e) => 42 | { 43 | AdornerBehaviorBase control = d as AdornerBehaviorBase; 44 | 45 | if (control == null) return; 46 | 47 | if (e.OldValue is Visual o) 48 | { 49 | 50 | } 51 | 52 | if (e.NewValue is Visual n) 53 | { 54 | 55 | } 56 | })); 57 | 58 | public bool IsUse 59 | { 60 | get { return (bool)GetValue(IsUseProperty); } 61 | set { SetValue(IsUseProperty, value); } 62 | } 63 | 64 | 65 | public static readonly DependencyProperty IsUseProperty = 66 | DependencyProperty.Register("IsUse", typeof(bool), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(true, (d, e) => 67 | { 68 | AdornerBehaviorBase control = d as AdornerBehaviorBase; 69 | 70 | if (control == null) return; 71 | 72 | if (e.OldValue is bool o) 73 | { 74 | 75 | } 76 | 77 | if (e.NewValue is bool n) 78 | { 79 | 80 | } 81 | })); 82 | 83 | 84 | public bool IsHitTestVisible 85 | { 86 | get { return (bool)GetValue(IsHitTestVisibleProperty); } 87 | set { SetValue(IsHitTestVisibleProperty, value); } 88 | } 89 | 90 | 91 | public static readonly DependencyProperty IsHitTestVisibleProperty = 92 | DependencyProperty.Register("IsHitTestVisible", typeof(bool), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(default(bool), (d, e) => 93 | { 94 | AdornerBehaviorBase control = d as AdornerBehaviorBase; 95 | 96 | if (control == null) return; 97 | 98 | if (e.OldValue is bool o) 99 | { 100 | 101 | } 102 | 103 | if (e.NewValue is bool n) 104 | { 105 | 106 | } 107 | 108 | })); 109 | 110 | 111 | } 112 | } 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Behavior.Adorner.Loaded.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | using System; 5 | using System.Linq; 6 | #if NET 7 | #endif 8 | using System.Windows; 9 | using System.Windows.Documents; 10 | 11 | namespace HeBianGu.Diagram.Presenter 12 | { 13 | public class LoadedAdornerBehavior : AdornerBehaviorBase 14 | { 15 | protected override void OnAttached() 16 | { 17 | AssociatedObject.Loaded += AssociatedObject_Loaded; 18 | } 19 | 20 | private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) 21 | { 22 | Refresh(); 23 | } 24 | 25 | private void Refresh() 26 | { 27 | if (AdornerType == null) return; 28 | 29 | if (AdornerVisual == null) 30 | AdornerVisual = AssociatedObject; 31 | 32 | AdornerLayer layer = AdornerLayer.GetAdornerLayer(AdornerVisual); 33 | if (layer == null) return; 34 | 35 | var adorners = layer.GetAdorners(AdornerVisual as UIElement)?.Where(l => l.GetType() == AdornerType); 36 | 37 | if (adorners != null) 38 | { 39 | foreach (var item in adorners) 40 | { 41 | layer.Remove(item); 42 | } 43 | } 44 | 45 | if (IsUse) 46 | { 47 | var adorner = Activator.CreateInstance(AdornerType, AssociatedObject) as System.Windows.Documents.Adorner; 48 | if (adorner == null) 49 | return; 50 | layer.Add(adorner); 51 | } 52 | } 53 | 54 | protected override void OnDetaching() 55 | { 56 | AssociatedObject.Loaded -= AssociatedObject_Loaded; 57 | } 58 | 59 | } 60 | } 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/DiagramDropDispalyNodeBehavior.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | using System; 5 | using System.Windows; 6 | 7 | 8 | namespace HeBianGu.Diagram.Presenter 9 | { 10 | public class DiagramDropTextNodeBehavior : DiagramDropBehaviorBase 11 | { 12 | public Type NodeType 13 | { 14 | get { return (Type)GetValue(NodeTypeProperty); } 15 | set { SetValue(NodeTypeProperty, value); } 16 | } 17 | 18 | 19 | public static readonly DependencyProperty NodeTypeProperty = 20 | DependencyProperty.Register("NodeType", typeof(Type), typeof(DiagramDropTextNodeBehavior), new FrameworkPropertyMetadata(typeof(Node), (d, e) => 21 | { 22 | DiagramDropTextNodeBehavior control = d as DiagramDropTextNodeBehavior; 23 | 24 | if (control == null) return; 25 | 26 | if (e.OldValue is Type o) 27 | { 28 | 29 | } 30 | 31 | if (e.NewValue is Type n) 32 | { 33 | 34 | } 35 | 36 | })); 37 | 38 | 39 | protected override Node Create(INodeData nodeData) 40 | { 41 | ISystemNodeData componentNode = nodeData as ISystemNodeData; 42 | Node node = Activator.CreateInstance(this.NodeType) as Node; 43 | foreach (IPortData p in componentNode.PortDatas) 44 | { 45 | Port port = Port.Create(node); 46 | port.Dock = p.Dock; 47 | //port.Visibility = Visibility.Collapsed; 48 | port.PortType = p.PortType; 49 | port.Content = p; 50 | port.Margin = p.PortMargin; 51 | node.AddPort(port); 52 | } 53 | 54 | if (nodeData is ITemplate template) 55 | { 56 | template.IsTemplate = false; 57 | } 58 | 59 | return node; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/DiagramKeys.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public class DiagramKeys 6 | { 7 | public static ComponentResourceKey TextKey => new ComponentResourceKey(typeof(DiagramKeys), "S.TextBox.Text"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/DiagramTheme.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | using HeBianGu.Diagram.DrawingBox; 6 | 7 | namespace HeBianGu.Diagram.Presenter 8 | { 9 | public class DiagramTheme : BindableBase 10 | { 11 | private TextNodeData _note = new TextNodeData(); 12 | public TextNodeData Note 13 | { 14 | get { return _note; } 15 | set 16 | { 17 | _note = value; 18 | RaisePropertyChanged(); 19 | } 20 | } 21 | 22 | private TextLinkData _link = new TextLinkData(); 23 | public TextLinkData Link 24 | { 25 | get { return _link; } 26 | set 27 | { 28 | _link = value; 29 | RaisePropertyChanged(); 30 | } 31 | } 32 | 33 | 34 | private TextPortData _port = new TextPortData(); 35 | public TextPortData Port 36 | { 37 | get { return _port; } 38 | set 39 | { 40 | _port = value; 41 | RaisePropertyChanged(); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/DiagramThemeGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public class DiagramThemeGroup : ObservableCollection 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/DropAdornerBehavior.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | using HeBianGu.Diagram.DrawingBox; 5 | using Microsoft.Xaml.Behaviors; 6 | using System.IO; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Markup; 10 | using System.Xml; 11 | 12 | namespace HeBianGu.Diagram.Presenter 13 | { 14 | /// 用于显示ListBoxItem拖拽进行时的效果,通过附加属性Bool修改样式 15 | public abstract class DropAdornerBehavior : Behavior where T : UIElement 16 | { 17 | /// 判断可否放置的分组 18 | public string DragGroup 19 | { 20 | get { return (string)GetValue(DragGroupProperty); } 21 | set { SetValue(DragGroupProperty, value); } 22 | } 23 | 24 | 25 | public static readonly DependencyProperty DragGroupProperty = 26 | DependencyProperty.Register("DragGroup", typeof(string), typeof(DropAdornerBehavior), new PropertyMetadata("DragGroup", (d, e) => 27 | { 28 | DropAdornerBehavior control = d as DropAdornerBehavior; 29 | 30 | if (control == null) return; 31 | 32 | string config = e.NewValue as string; 33 | 34 | })); 35 | 36 | protected override void OnAttached() 37 | { 38 | this.AssociatedObject.Drop += AssociatedObject_Drop; 39 | } 40 | 41 | private void AssociatedObject_Drop(object sender, DragEventArgs e) 42 | { 43 | DragAdorner adorner = e.Data.GetData("DragGroup") as DragAdorner; 44 | 45 | if (adorner == null) return; 46 | 47 | string temp = XamlWriter.Save(adorner.AdornedElement); 48 | 49 | StringReader stringReader = new StringReader(temp); 50 | 51 | XmlReader xmlReader = XmlReader.Create(stringReader); 52 | 53 | UIElement element = XamlReader.Load(xmlReader) as UIElement; 54 | 55 | Point offset = adorner.Offset; 56 | 57 | Point location = e.GetPosition(this.AssociatedObject); 58 | 59 | this.DropElement(element, location, offset); 60 | } 61 | 62 | protected override void OnDetaching() 63 | { 64 | this.AssociatedObject.Drop -= AssociatedObject_Drop; 65 | } 66 | 67 | protected abstract void DropElement(UIElement element, Point location, Point offset); 68 | } 69 | 70 | 71 | public class DropAdornerCanvasBehavior : DropAdornerBehavior 72 | { 73 | protected override void DropElement(UIElement element, Point location, Point offset) 74 | { 75 | this.AssociatedObject.Children.Add(element); 76 | 77 | Canvas.SetLeft(element, location.X - offset.X); 78 | 79 | Canvas.SetTop(element, location.Y - offset.Y); 80 | } 81 | } 82 | } 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/IDefaultable.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | public interface IDefaultable 4 | { 5 | void LoadDefault(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/IDiagramTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | public interface IDiagramTemplate 4 | { 5 | public string Name { get; set; } 6 | 7 | public string GroupName { get; set; } 8 | 9 | public string TypeName { get; set; } 10 | 11 | public IDiagram Diagram { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/IDragAdorner.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | using System.Windows; 5 | 6 | namespace H.Controls.Adorner 7 | { 8 | public interface IDragAdorner 9 | { 10 | Point Offset { get; set; } 11 | void UpdatePosition(Point location); 12 | object GetData(); 13 | } 14 | } 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/IModelBindable.T.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | 4 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 5 | 6 | namespace HeBianGu.Diagram.Presenter 7 | { 8 | public interface IModelBindable : IModelBindable 9 | { 10 | T Model { get; set; } 11 | double Value { get; set; } 12 | bool Visible { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/IModelBindable.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public interface IModelBindable 6 | { 7 | object GetModel(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/ISearchable.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public interface ISearchable 6 | { 7 | bool Filter(string txt); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/ISelectBindable.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public interface ISelectBindable 6 | { 7 | bool IsSelected { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/NodeGroup.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | 5 | 6 | namespace HeBianGu.Diagram.Presenter 7 | { 8 | public class NodeGroup : ObservableCollection 9 | { 10 | public NodeGroup() 11 | { 12 | 13 | } 14 | 15 | public NodeGroup(IEnumerable collection) : base(collection) 16 | { 17 | 18 | } 19 | public string Name { get; set; } 20 | 21 | public int Columns { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/SelectBindable.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.ComponentModel; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | 8 | public partial class SelectBindable : ModelBindable, ISelectBindable 9 | { 10 | public SelectBindable(T t) : base(t) 11 | { 12 | 13 | } 14 | 15 | private bool _isSelected; 16 | [Browsable(false)] 17 | public bool IsSelected 18 | { 19 | get { return _isSelected; } 20 | set 21 | { 22 | _isSelected = value; 23 | RaisePropertyChanged(); 24 | } 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Seriliaze/XmlDiagramData.cs: -------------------------------------------------------------------------------- 1 |  2 | using HeBianGu.Diagram.DrawingBox; 3 | using System.Collections.Generic; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public class XmlDiagramData 8 | { 9 | public List Nodes { get; set; } = new List(); 10 | public List Links { get; set; } = new List(); 11 | public List ReferenceTemplates { get; set; } = new List(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Seriliaze/XmlStringData.cs: -------------------------------------------------------------------------------- 1 | namespace HeBianGu.Diagram.Presenter 2 | { 3 | public class XmlStringData 4 | { 5 | public XmlStringData() 6 | { 7 | 8 | } 9 | public XmlStringData(string value) 10 | { 11 | this.Value = value; 12 | } 13 | public string Value { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Tree/ITreeNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | using System.Windows; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public interface ITreeNode 8 | { 9 | bool IsExpanded { get; set; } 10 | bool? IsChecked { get; set; } 11 | Visibility Visibility { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Tree/LinkTreeNode.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public class LinkTreeNode : PartTreeNodeBase 8 | { 9 | public LinkTreeNode(Link model) : base(model) 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Tree/NodeTreeNode.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public class NodeTreeNode : PartTreeNodeBase 8 | { 9 | public NodeTreeNode(Node model) : base(model) 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Tree/PartTreeNodeBase.cs: -------------------------------------------------------------------------------- 1 |  2 | using HeBianGu.Diagram.DrawingBox; 3 | 4 | namespace HeBianGu.Diagram.Presenter 5 | { 6 | public abstract class PartTreeNodeBase : TreeNodeBase 7 | { 8 | public PartTreeNodeBase(Part model) : base(model) 9 | 10 | { 11 | 12 | } 13 | public void RefreshSelected() 14 | { 15 | this.IsSelected = this.Model.IsSelected; 16 | if (this.IsSelected == true && this.Parent != null) 17 | this.Parent.IsExpanded = true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Provider/Tree/PortTreeNode.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using HeBianGu.Diagram.DrawingBox; 4 | 5 | namespace HeBianGu.Diagram.Presenter 6 | { 7 | public class PortTreeNode : PartTreeNodeBase 8 | { 9 | public PortTreeNode(Port model) : base(model) 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Service/Extention.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace System 4 | { 5 | public static class Extention 6 | { 7 | ///// 8 | ///// 注册 9 | ///// 10 | ///// 11 | //public static void AddDiagram(this IServiceCollection service) 12 | //{ 13 | // service.AddSingleton(); 14 | //} 15 | 16 | ///// 17 | ///// 配置 18 | ///// 19 | ///// 20 | //public static void UseDiagram(this IApplicationBuilder service, Action action = null) 21 | //{ 22 | // action?.Invoke(DiagramSetting.Instance); 23 | // SettingDataManager.Instance.Add(DiagramSetting.Instance); 24 | //} 25 | 26 | ///// 27 | ///// 配置 28 | ///// 29 | ///// 30 | //public static void UseApp(this IApplicationBuilder service, Action action = null) 31 | //{ 32 | // action?.Invoke(AppSetting.Instance); 33 | // SettingDataManager.Instance.Add(AppSetting.Instance); 34 | //} 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Source/Control/HeBianGu.Diagram.Presenter/Service/Service.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control 2 | 3 | namespace HeBianGu.Diagram.Presenter 4 | { 5 | public class DiagramService : IDiagramService 6 | { 7 | 8 | } 9 | 10 | public interface IDiagramService 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /WPF-Package.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33213.308 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeBianGu.Diagram.DrawingBox", "Source\Control\HeBianGu.Diagram.DrawingBox\HeBianGu.Diagram.DrawingBox.csproj", "{0886D6EF-0FCE-40D6-94D4-2C283978908D}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeBianGu.Diagram.Presenter", "Source\Control\HeBianGu.Diagram.Presenter\HeBianGu.Diagram.Presenter.csproj", "{FB4C1E72-89D4-498C-8E78-8A87CEDD65D9}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeBianGu.Diagram.Presenter.Workflow", "Source\Control\HeBianGu.Diagram.Presenter.Workflow\HeBianGu.Diagram.Presenter.Workflow.csproj", "{44FB6059-04F5-401F-9EBF-849181AE5E3D}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {0886D6EF-0FCE-40D6-94D4-2C283978908D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {0886D6EF-0FCE-40D6-94D4-2C283978908D}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {0886D6EF-0FCE-40D6-94D4-2C283978908D}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {0886D6EF-0FCE-40D6-94D4-2C283978908D}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {FB4C1E72-89D4-498C-8E78-8A87CEDD65D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {FB4C1E72-89D4-498C-8E78-8A87CEDD65D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {FB4C1E72-89D4-498C-8E78-8A87CEDD65D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {FB4C1E72-89D4-498C-8E78-8A87CEDD65D9}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {44FB6059-04F5-401F-9EBF-849181AE5E3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {44FB6059-04F5-401F-9EBF-849181AE5E3D}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {44FB6059-04F5-401F-9EBF-849181AE5E3D}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {44FB6059-04F5-401F-9EBF-849181AE5E3D}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {DF825C3D-F4F4-4E62-BBFF-B42A5E81112F} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /settings.xamlstyler: -------------------------------------------------------------------------------- 1 | { 2 | "AttributesTolerance": 1, 3 | "KeepFirstAttributeOnSameLine": true, 4 | "MaxAttributeCharactersPerLine": 0, 5 | "MaxAttributesPerLine": 1, 6 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter", 7 | "SeparateByGroups": false, 8 | "AttributeIndentation": 0, 9 | "AttributeIndentationStyle": 1, 10 | "RemoveDesignTimeReferences": false, 11 | "EnableAttributeReordering": true, 12 | "AttributeOrderingRuleGroups": [ 13 | "x:Class", 14 | "xmlns, xmlns:x", 15 | "xmlns:*", 16 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title", 17 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom", 18 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight", 19 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex", 20 | "*:*, *", 21 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint", 22 | "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText", 23 | "Storyboard.*, From, To, Duration" 24 | ], 25 | "FirstLineAttributes": "", 26 | "OrderAttributesByName": true, 27 | "PutEndingBracketOnNewLine": false, 28 | "RemoveEndingTagOfEmptyElement": true, 29 | "SpaceBeforeClosingSlash": true, 30 | "RootElementLineBreakRule": 0, 31 | "ReorderVSM": 1, 32 | "ReorderGridChildren": false, 33 | "ReorderCanvasChildren": false, 34 | "ReorderSetters": 0, 35 | "FormatMarkupExtension": true, 36 | "NoNewLineMarkupExtensions": "x:Bind, Binding", 37 | "ThicknessSeparator": 2, 38 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin", 39 | "FormatOnSave": true, 40 | "CommentPadding": 2, 41 | "IndentSize": 4 42 | } --------------------------------------------------------------------------------