mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-04 08:06:36 +08:00
Demo整理
This commit is contained in:
@@ -23,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决
|
||||
Directory.Build.Props = Directory.Build.Props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIStudio.Wpf.DiagramDesigner.Test", "AIStudio.Wpf.DiagramDesigner.Test\AIStudio.Wpf.DiagramDesigner.Test.csproj", "{559BBB2C-03DE-4C95-B38F-538F0A275793}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramDesigner.Demo", "AIStudio.Wpf.DiagramDesigner.Demo\AIStudio.Wpf.DiagramDesigner.Demo.csproj", "{D0467F47-D782-4A84-9AAE-E4A014913AA6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -55,10 +55,10 @@ Global
|
||||
{1E77B64D-B457-4467-A5DB-BB7BA01806D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E77B64D-B457-4467-A5DB-BB7BA01806D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E77B64D-B457-4467-A5DB-BB7BA01806D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{559BBB2C-03DE-4C95-B38F-538F0A275793}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{559BBB2C-03DE-4C95-B38F-538F0A275793}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{559BBB2C-03DE-4C95-B38F-538F0A275793}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{559BBB2C-03DE-4C95-B38F-538F0A275793}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D0467F47-D782-4A84-9AAE-E4A014913AA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D0467F47-D782-4A84-9AAE-E4A014913AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D0467F47-D782-4A84-9AAE-E4A014913AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D0467F47-D782-4A84-9AAE-E4A014913AA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
73
AIStudio.Wpf.DiagramDesigner.Demo/App.xaml
Normal file
73
AIStudio.Wpf.DiagramDesigner.Demo/App.xaml
Normal file
@@ -0,0 +1,73 @@
|
||||
<Application x:Class="AIStudio.Wpf.DiagramDesigner.Demo.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<!-- Accent colors -->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentBaseColor">#FF0078D7</Color>
|
||||
<!--80%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor80">#CC0078D7</Color>
|
||||
<!--60%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor60">#990078D7</Color>
|
||||
<!--40%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor40">#660078D7</Color>
|
||||
<!--20%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor20">#330078D7</Color>
|
||||
<Color x:Key="Fluent.Ribbon.Colors.HighlightColor">#FF086F9E</Color>
|
||||
<Color x:Key="BlackColor">#FF000000</Color>
|
||||
<Color x:Key="BlackColor20">#51000000</Color>
|
||||
<Color x:Key="WhiteColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="WhiteColor20">#51FFFFFF</Color>
|
||||
<Color x:Key="Gray1">#FF333333</Color>
|
||||
<Color x:Key="Gray2">#FF7F7F7F</Color>
|
||||
<Color x:Key="Gray3">#FF9D9D9D</Color>
|
||||
<Color x:Key="Gray4">#FFA59F93</Color>
|
||||
<Color x:Key="Gray5">#FFB9B9B9</Color>
|
||||
<Color x:Key="Gray6">#FFCCCCCC</Color>
|
||||
<Color x:Key="Gray7">#FFD8D8D9</Color>
|
||||
<Color x:Key="Gray8">#FFE0E0E0</Color>
|
||||
<Color x:Key="Gray9">#5EC9C9C9</Color>
|
||||
<Color x:Key="Gray10">#FFF7F7F7</Color>
|
||||
<Color x:Key="TransparentWhiteColor">#00FFFFFF</Color>
|
||||
<Color x:Key="Fluent.Ribbon.Colors.HighTransparentWhiteColor">#17FFFFFF</Color>
|
||||
|
||||
<!-- Accent brushes -->
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentBaseColorBrush" Color="{StaticResource Fluent.Ribbon.Colors.AccentBaseColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush80" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor80}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush60" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor60}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush40" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor40}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush20" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.HighlightBrush" Color="{StaticResource Fluent.Ribbon.Colors.HighlightColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource WhiteColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="WhiteBrush20" Color="{StaticResource WhiteColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource BlackColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="BlackBrush20" Color="{StaticResource BlackColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush1" Color="{StaticResource Gray1}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush2" Color="{StaticResource Gray2}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush3" Color="{StaticResource Gray3}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush4" Color="{StaticResource Gray4}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush5" Color="{StaticResource Gray5}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush6" Color="{StaticResource Gray6}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush7" Color="{StaticResource Gray7}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush8" Color="{StaticResource Gray8}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.Button.MouseOver.Background" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ScrollBar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/Expander.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/GroupBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ToolTip.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ScrollViewer.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ZoomBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Test
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
23
AIStudio.Wpf.DiagramDesigner.Demo/MainWindow.xaml
Normal file
23
AIStudio.Wpf.DiagramDesigner.Demo/MainWindow.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<Window x:Class="AIStudio.Wpf.DiagramDesigner.Demo.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox x:Name="listbox" SelectionChanged="ListBox_SelectionChanged">
|
||||
|
||||
</ListBox>
|
||||
<GridSplitter Width="2"
|
||||
VerticalAlignment="Stretch" />
|
||||
<ContentControl x:Name="ContentControl"
|
||||
Grid.Column="1"
|
||||
Margin="0" />
|
||||
</Grid>
|
||||
</Window>
|
||||
89
AIStudio.Wpf.DiagramDesigner.Demo/MainWindow.xaml.cs
Normal file
89
AIStudio.Wpf.DiagramDesigner.Demo/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using AIStudio.Wpf.DiagramDesigner.Demo.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
#region Identity
|
||||
private static IDictionary<string, Type> _viewDic;
|
||||
private static IDictionary<string, Type> _viewModelDic;
|
||||
|
||||
static MainWindow()
|
||||
{
|
||||
_viewDic = new Dictionary<string, Type>();
|
||||
_viewModelDic = new Dictionary<string, Type>();
|
||||
var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName.StartsWith("AIStudio.Wpf.DiagramDesigner.Demo"));
|
||||
assembly.GetTypes().Where(x => x.Namespace.StartsWith("AIStudio.Wpf.DiagramDesigner.Demo.Views") && x.IsSubclassOf(typeof(UserControl))).ToList().ForEach(x => _viewDic.Add(x.Name.Remove(x.Name.Length - 4), x));
|
||||
assembly.GetTypes().Where(x => x.Namespace.StartsWith("AIStudio.Wpf.DiagramDesigner.Demo.ViewModels") && x.Name.Contains("ViewModel")).ToList().ForEach(x => _viewModelDic.Add(x.Name.Remove(x.Name.Length - 9), x));
|
||||
}
|
||||
#endregion
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += MainWindow_Loaded;
|
||||
listbox.ItemsSource = _viewDic.Keys.ToList();
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ListBox_SelectionChanged(null, null);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
var tag = button.Content?.ToString();
|
||||
|
||||
ShowContent(tag);
|
||||
}
|
||||
|
||||
private void ShowContent(string tag)
|
||||
{
|
||||
if (tag == null) return;
|
||||
|
||||
if (_viewDic.ContainsKey(tag))
|
||||
{
|
||||
var control = Activator.CreateInstance(_viewDic[tag]) as UserControl;
|
||||
if (_viewModelDic.ContainsKey(tag))
|
||||
{
|
||||
var viewmodel = Activator.CreateInstance(_viewModelDic[tag]);
|
||||
if (viewmodel != null)
|
||||
{
|
||||
control.DataContext = viewmodel;
|
||||
}
|
||||
}
|
||||
ContentControl.Content = control;
|
||||
}
|
||||
else
|
||||
ContentControl.Content = null;
|
||||
}
|
||||
|
||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
var tag = listbox.SelectedItem as string;
|
||||
|
||||
ShowContent(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ using System.Windows;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
||||
{
|
||||
public class TabItem1ViewModel: BindableBase
|
||||
public class DragAndDropViewModel: BindableBase
|
||||
{
|
||||
public ToolBoxViewModel ToolBoxViewModel
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public TabItem1ViewModel()
|
||||
public DragAndDropViewModel()
|
||||
{
|
||||
ToolBoxViewModel = new ToolBoxViewModel();
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
@@ -75,7 +75,6 @@ namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.DrawModeViewModel = new DrawModeViewModel() { LineDrawMode = DrawMode.ConnectingLineBoundary };
|
||||
|
||||
DiagramViewModel.PropertyChanged += DiagramViewModel_PropertyChanged;
|
||||
}
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
||||
{
|
||||
public class TabItem2ViewModel : BindableBase
|
||||
public class FlowchartEditorViewModel : BindableBase
|
||||
{
|
||||
private List<SelectOption> _users = new List<SelectOption>()
|
||||
{
|
||||
@@ -108,7 +108,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public TabItem2ViewModel()
|
||||
public FlowchartEditorViewModel()
|
||||
{
|
||||
GetDataCommand = new SimpleCommand(GetDataExcute);
|
||||
SetDataCommand = new SimpleCommand(SetDataExcute);
|
||||
75
AIStudio.Wpf.DiagramDesigner.Demo/Views/DragAndDropView.xaml
Normal file
75
AIStudio.Wpf.DiagramDesigner.Demo/Views/DragAndDropView.xaml
Normal file
@@ -0,0 +1,75 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.DragAndDropView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid x:Name="grid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- ToolBox Control -->
|
||||
<dd:ToolBoxControl Grid.Column="0" />
|
||||
|
||||
<GridSplitter Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
Width="3" />
|
||||
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl Grid.Column="1" x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<dd:PropertiesView Grid.Column="2" CustomSetting="True" SelectedObject="{Binding SelectedItem}" Width="200">
|
||||
<dd:PropertiesView.Resources>
|
||||
|
||||
<Style x:Key="ActTypeStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<ComboBox BorderThickness="0" Text="{Binding ActType}" Style="{StaticResource ComboBoxStyle}">
|
||||
<ComboBoxItem Content="or"/>
|
||||
<ComboBoxItem Content="and"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="UserIdsStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
|
||||
SelectedValues="{Binding UserIds}"
|
||||
ItemsSource="{Binding Path=DataContext.Users,RelativeSource={RelativeSource AncestorType={x:Type Window}}}" ></dd:MultiSelectComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="RoleIdsStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
|
||||
SelectedValues="{Binding RoleIds}"
|
||||
ItemsSource="{Binding Path=DataContext.Roles,RelativeSource={RelativeSource AncestorType={x:Type Window}}}"></dd:MultiSelectComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</dd:PropertiesView.Resources>
|
||||
</dd:PropertiesView>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
@@ -12,19 +10,17 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using AIStudio.Wpf.DiagramDesigner.Test.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Test
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// DragAndDropView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
public partial class DragAndDropView : UserControl
|
||||
{
|
||||
public MainWindow()
|
||||
public DragAndDropView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new MainWindowViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.FlowchartEditorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding InputData}"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Height="50"/>
|
||||
<Button Grid.Column="1" Content="加载数据" Command="{Binding SetDataCommand}"/>
|
||||
<Button Grid.Column="2" Content="获取数据" Command="{Binding GetDataCommand}"/>
|
||||
<TextBox Grid.Column="3" Text="{Binding OutputData}"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Height="50"/>
|
||||
|
||||
</Grid>
|
||||
<dd:FlowchartEditor Grid.Row="1" Data="{Binding Data}"
|
||||
GetDataFunc="{Binding GetDataFunc,Mode=OneWayToSource}"
|
||||
Users="{Binding Users}"
|
||||
Roles="{Binding Roles}">
|
||||
</dd:FlowchartEditor>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// FlowchartEditorDemo.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class FlowchartEditorView : UserControl
|
||||
{
|
||||
public FlowchartEditorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<Application x:Class="AIStudio.Wpf.DiagramDesigner.Test.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Test"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ScrollBar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/Expander.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/GroupBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ToolTip.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ScrollViewer.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ZoomBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,175 +0,0 @@
|
||||
<Window x:Class="AIStudio.Wpf.DiagramDesigner.Test.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramDesigner.Test"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
|
||||
<ResourceDictionary>
|
||||
<!-- Accent colors -->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentBaseColor">#FF0078D7</Color>
|
||||
<!--80%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor80">#CC0078D7</Color>
|
||||
<!--60%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor60">#990078D7</Color>
|
||||
<!--40%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor40">#660078D7</Color>
|
||||
<!--20%-->
|
||||
<Color x:Key="Fluent.Ribbon.Colors.AccentColor20">#330078D7</Color>
|
||||
<Color x:Key="Fluent.Ribbon.Colors.HighlightColor">#FF086F9E</Color>
|
||||
<Color x:Key="BlackColor">#FF000000</Color>
|
||||
<Color x:Key="BlackColor20">#51000000</Color>
|
||||
<Color x:Key="WhiteColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="WhiteColor20">#51FFFFFF</Color>
|
||||
<Color x:Key="Gray1">#FF333333</Color>
|
||||
<Color x:Key="Gray2">#FF7F7F7F</Color>
|
||||
<Color x:Key="Gray3">#FF9D9D9D</Color>
|
||||
<Color x:Key="Gray4">#FFA59F93</Color>
|
||||
<Color x:Key="Gray5">#FFB9B9B9</Color>
|
||||
<Color x:Key="Gray6">#FFCCCCCC</Color>
|
||||
<Color x:Key="Gray7">#FFD8D8D9</Color>
|
||||
<Color x:Key="Gray8">#FFE0E0E0</Color>
|
||||
<Color x:Key="Gray9">#5EC9C9C9</Color>
|
||||
<Color x:Key="Gray10">#FFF7F7F7</Color>
|
||||
<Color x:Key="TransparentWhiteColor">#00FFFFFF</Color>
|
||||
<Color x:Key="Fluent.Ribbon.Colors.HighTransparentWhiteColor">#17FFFFFF</Color>
|
||||
|
||||
<!-- Accent brushes -->
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentBaseColorBrush" Color="{StaticResource Fluent.Ribbon.Colors.AccentBaseColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush80" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor80}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush60" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor60}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush40" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor40}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush20" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.HighlightBrush" Color="{StaticResource Fluent.Ribbon.Colors.HighlightColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource WhiteColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="WhiteBrush20" Color="{StaticResource WhiteColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource BlackColor}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="BlackBrush20" Color="{StaticResource BlackColor20}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush1" Color="{StaticResource Gray1}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush2" Color="{StaticResource Gray2}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush3" Color="{StaticResource Gray3}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush4" Color="{StaticResource Gray4}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush5" Color="{StaticResource Gray5}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush6" Color="{StaticResource Gray6}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush7" Color="{StaticResource Gray7}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush8" Color="{StaticResource Gray8}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.Button.MouseOver.Background" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<TabControl>
|
||||
<TabItem Header="Custom" >
|
||||
<Grid x:Name="grid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- ToolBox Control -->
|
||||
<dd:ToolBoxControl Grid.Column="0" />
|
||||
|
||||
<GridSplitter Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
Width="3" />
|
||||
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl Grid.Column="1" x:Name="diagram" DataContext="{Binding TabItem1ViewModel.DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<dd:PropertiesView Grid.Column="2" CustomSetting="True" SelectedObject="{Binding TabItem1ViewModel.SelectedItem}" Width="200">
|
||||
<dd:PropertiesView.Resources>
|
||||
|
||||
<Style x:Key="ActTypeStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<ComboBox BorderThickness="0" Text="{Binding ActType}" Style="{StaticResource ComboBoxStyle}">
|
||||
<ComboBoxItem Content="or"/>
|
||||
<ComboBoxItem Content="and"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="UserIdsStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
|
||||
SelectedValues="{Binding UserIds}"
|
||||
ItemsSource="{Binding Path=DataContext.TabItem1ViewModel.Users,RelativeSource={RelativeSource AncestorType={x:Type Window}}}" ></dd:MultiSelectComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="RoleIdsStyle" TargetType="{x:Type ContentControl}">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
|
||||
<dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
|
||||
SelectedValues="{Binding RoleIds}"
|
||||
ItemsSource="{Binding Path=DataContext.TabItem1ViewModel.Roles,RelativeSource={RelativeSource AncestorType={x:Type Window}}}"></dd:MultiSelectComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</dd:PropertiesView.Resources>
|
||||
</dd:PropertiesView>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Flowchart" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding TabItem2ViewModel.InputData}"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Height="50"/>
|
||||
<Button Grid.Column="1" Content="加载数据" Command="{Binding TabItem2ViewModel.SetDataCommand}"/>
|
||||
<Button Grid.Column="2" Content="获取数据" Command="{Binding TabItem2ViewModel.GetDataCommand}"/>
|
||||
<TextBox Grid.Column="3" Text="{Binding TabItem2ViewModel.OutputData}"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Height="50"/>
|
||||
|
||||
</Grid>
|
||||
<dd:FlowchartEditor Grid.Row="1" Data="{Binding TabItem2ViewModel.Data}"
|
||||
GetDataFunc="{Binding TabItem2ViewModel.GetDataFunc,Mode=OneWayToSource}"
|
||||
Users="{Binding TabItem2ViewModel.Users}"
|
||||
Roles="{Binding TabItem2ViewModel.Roles}">
|
||||
</dd:FlowchartEditor>
|
||||
</Grid>
|
||||
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Window>
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
|
||||
{
|
||||
class MainWindowViewModel : BindableBase
|
||||
{
|
||||
public TabItem1ViewModel TabItem1ViewModel
|
||||
{
|
||||
get; set;
|
||||
} = new TabItem1ViewModel();
|
||||
|
||||
public TabItem2ViewModel TabItem2ViewModel
|
||||
{
|
||||
|
||||
get; set;
|
||||
} = new TabItem2ViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public static class IsSelectedProps
|
||||
{
|
||||
#region IsSelected
|
||||
|
||||
public static readonly DependencyProperty IsSelectedProperty =
|
||||
DependencyProperty.RegisterAttached("IsSelected", typeof(bool), typeof(IsSelectedProps),
|
||||
new FrameworkPropertyMetadata(false));
|
||||
|
||||
public static bool GetIsSelected(DependencyObject d)
|
||||
{
|
||||
return (bool)d.GetValue(IsSelectedProperty);
|
||||
}
|
||||
|
||||
public static void SetIsSelected(DependencyObject d, bool value)
|
||||
{
|
||||
d.SetValue(IsSelectedProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user