mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-21 08:56:36 +08:00
Demo整理
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner\AIStudio.Wpf.DiagramDesigner.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramHelper\AIStudio.Wpf.DiagramHelper.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
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>
|
||||
17
AIStudio.Wpf.DiagramDesigner.Demo/App.xaml.cs
Normal file
17
AIStudio.Wpf.DiagramDesigner.Demo/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
10
AIStudio.Wpf.DiagramDesigner.Demo/AssemblyInfo.cs
Normal file
10
AIStudio.Wpf.DiagramDesigner.Demo/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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.Demo.ViewModels
|
||||
{
|
||||
public class DragAndDropViewModel: BindableBase
|
||||
{
|
||||
public ToolBoxViewModel ToolBoxViewModel
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public DiagramViewModel DiagramViewModel
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
|
||||
public SelectableDesignerItemViewModelBase SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiagramViewModel.SelectedItems?.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private List<SelectOption> _users = new List<SelectOption>()
|
||||
{
|
||||
new SelectOption(){ value = "操作员1",text = "操作员1" },
|
||||
new SelectOption(){ value = "操作员2",text = "操作员2" },
|
||||
new SelectOption(){ value = "Admin",text = "Admin" },
|
||||
};
|
||||
public List<SelectOption> Users
|
||||
{
|
||||
get
|
||||
{
|
||||
return _users;
|
||||
}
|
||||
set
|
||||
{
|
||||
_users = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<SelectOption> _roles = new List<SelectOption>()
|
||||
{
|
||||
new SelectOption(){ value = "操作员",text = "操作员" },
|
||||
new SelectOption(){ value = "管理员",text = "管理员" },
|
||||
};
|
||||
public List<SelectOption> Roles
|
||||
{
|
||||
get
|
||||
{
|
||||
return _roles;
|
||||
}
|
||||
set
|
||||
{
|
||||
_roles = value;
|
||||
}
|
||||
}
|
||||
|
||||
public DragAndDropViewModel()
|
||||
{
|
||||
ToolBoxViewModel = new ToolBoxViewModel();
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.ShowGrid = true;
|
||||
DiagramViewModel.GridCellSize = new Size(100, 100);
|
||||
DiagramViewModel.GridMarginSize = new Size(0, 0);
|
||||
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
|
||||
DiagramViewModel.PropertyChanged += DiagramViewModel_PropertyChanged;
|
||||
}
|
||||
|
||||
private void DiagramViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "IsSelected")
|
||||
{
|
||||
RaisePropertyChanged(nameof(SelectedItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
||||
{
|
||||
public class FlowchartEditorViewModel : BindableBase
|
||||
{
|
||||
private List<SelectOption> _users = new List<SelectOption>()
|
||||
{
|
||||
new SelectOption(){ value = "操作员1",text = "操作员1" },
|
||||
new SelectOption(){ value = "操作员2",text = "操作员2" },
|
||||
new SelectOption(){ value = "Admin",text = "Admin" },
|
||||
new SelectOption(){ value = "Bob",text = "Bob" },
|
||||
new SelectOption(){ value = "Alice",text = "Alice" },
|
||||
};
|
||||
public List<SelectOption> Users
|
||||
{
|
||||
get
|
||||
{
|
||||
return _users;
|
||||
}
|
||||
set
|
||||
{
|
||||
_users = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<SelectOption> _roles = new List<SelectOption>()
|
||||
{
|
||||
new SelectOption(){ value = "操作员",text = "操作员" },
|
||||
new SelectOption(){ value = "管理员",text = "管理员" },
|
||||
new SelectOption(){ value = "Admin",text = "Admin" },
|
||||
};
|
||||
public List<SelectOption> Roles
|
||||
{
|
||||
get
|
||||
{
|
||||
return _roles;
|
||||
}
|
||||
set
|
||||
{
|
||||
_roles = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Func<string> _getDataFunc;
|
||||
public Func<string> GetDataFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return _getDataFunc;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _getDataFunc, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _inputData;
|
||||
public string InputData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _inputData;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _inputData, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _outputData;
|
||||
public string OutputData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _outputData;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _outputData, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _data = "{}";
|
||||
public string Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _data, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SimpleCommand GetDataCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public SimpleCommand SetDataCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public FlowchartEditorViewModel()
|
||||
{
|
||||
GetDataCommand = new SimpleCommand(GetDataExcute);
|
||||
SetDataCommand = new SimpleCommand(SetDataExcute);
|
||||
}
|
||||
|
||||
private void GetDataExcute(object obj)
|
||||
{
|
||||
OutputData = GetDataFunc();
|
||||
}
|
||||
|
||||
private void SetDataExcute(object obj)
|
||||
{
|
||||
Data = "{}";
|
||||
Data = InputData;
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
@@ -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>
|
||||
/// DragAndDropView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DragAndDropView : UserControl
|
||||
{
|
||||
public DragAndDropView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user