diff --git a/AIStudio.Wpf.DiagramDesigner.Test/App.xaml b/AIStudio.Wpf.DiagramDesigner.Test/App.xaml
index b44c662..79745bd 100644
--- a/AIStudio.Wpf.DiagramDesigner.Test/App.xaml
+++ b/AIStudio.Wpf.DiagramDesigner.Test/App.xaml
@@ -14,6 +14,7 @@
+
diff --git a/AIStudio.Wpf.DiagramDesigner.Test/MainWindow.xaml b/AIStudio.Wpf.DiagramDesigner.Test/MainWindow.xaml
index ec43a6c..0efb080 100644
--- a/AIStudio.Wpf.DiagramDesigner.Test/MainWindow.xaml
+++ b/AIStudio.Wpf.DiagramDesigner.Test/MainWindow.xaml
@@ -14,6 +14,58 @@
+
+
+ #FF0078D7
+
+ #CC0078D7
+
+ #990078D7
+
+ #660078D7
+
+ #330078D7
+ #FF086F9E
+ #FF000000
+ #51000000
+ #FFFFFFFF
+ #51FFFFFF
+ #FF333333
+ #FF7F7F7F
+ #FF9D9D9D
+ #FFA59F93
+ #FFB9B9B9
+ #FFCCCCCC
+ #FFD8D8D9
+ #FFE0E0E0
+ #5EC9C9C9
+ #FFF7F7F7
+ #00FFFFFF
+ #17FFFFFF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -35,16 +87,15 @@
-
+
- #FFE0E0E0
-
+
-
+
diff --git a/AIStudio.Wpf.DiagramDesigner.Test/ViewModels/MainWindowViewModel.cs b/AIStudio.Wpf.DiagramDesigner.Test/ViewModels/MainWindowViewModel.cs
index 7d82dc2..210419a 100644
--- a/AIStudio.Wpf.DiagramDesigner.Test/ViewModels/MainWindowViewModel.cs
+++ b/AIStudio.Wpf.DiagramDesigner.Test/ViewModels/MainWindowViewModel.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
+using AIStudio.Wpf.Flowchart;
namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
{
@@ -34,6 +35,41 @@ namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
}
}
+ private List _users = new List()
+ {
+ new SelectOption(){ value = "操作员1",text = "操作员1" },
+ new SelectOption(){ value = "操作员2",text = "操作员2" },
+ new SelectOption(){ value = "Admin",text = "Admin" },
+ };
+ public List Users
+ {
+ get
+ {
+ return _users;
+ }
+ set
+ {
+ _users = value;
+ }
+ }
+
+ private List _roles = new List()
+ {
+ new SelectOption(){ value = "操作员",text = "操作员" },
+ new SelectOption(){ value = "管理员",text = "管理员" },
+ };
+ public List Roles
+ {
+ get
+ {
+ return _roles;
+ }
+ set
+ {
+ _roles = value;
+ }
+ }
+
public MainWindowViewModel()
{
ToolBoxViewModel = new ToolBoxViewModel();
@@ -58,5 +94,5 @@ namespace AIStudio.Wpf.DiagramDesigner.Test.ViewModels
}
}
}
-
+
}
diff --git a/AIStudio.Wpf.DiagramHelper/Controls/ComboBox.xaml b/AIStudio.Wpf.DiagramHelper/Controls/ComboBox.xaml
new file mode 100644
index 0000000..d49e87b
--- /dev/null
+++ b/AIStudio.Wpf.DiagramHelper/Controls/ComboBox.xaml
@@ -0,0 +1,94 @@
+
+
+
+
\ No newline at end of file
diff --git a/AIStudio.Wpf.DiagramHelper/Controls/MultiSelectComboBox.xaml b/AIStudio.Wpf.DiagramHelper/Controls/MultiSelectComboBox.xaml
index e804df6..96e1d8e 100644
--- a/AIStudio.Wpf.DiagramHelper/Controls/MultiSelectComboBox.xaml
+++ b/AIStudio.Wpf.DiagramHelper/Controls/MultiSelectComboBox.xaml
@@ -8,14 +8,18 @@
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="True"
- IsSynchronizedWithCurrentItem="True"
- >
-
+ IsSynchronizedWithCurrentItem="True">
+
+
+
+
+ Tag="{RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}"
+ Click="CheckBox_Click" />
@@ -63,8 +67,8 @@
-
-
+
- /// Interaction logic for PropertiesView.xaml
- ///
- public partial class PropertiesView : UserControl
- {
+ ///
+ /// Interaction logic for PropertiesView.xaml
+ ///
+ public partial class PropertiesView : UserControl
+ {
#region SelectedObject
public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register("SelectedObject", typeof(object), typeof(PropertiesView), new UIPropertyMetadata(null, OnSelectedObjectChanged));
@@ -70,159 +70,194 @@ namespace AIStudio.Wpf.DiagramHelper.Controls
}
}
+ public bool CustomSetting
+ {
+ get;
+ set;
+ }
+
public PropertiesView()
- {
- InitializeComponent();
- this.Loaded += PropertiesView_Loaded;
- }
+ {
+ InitializeComponent();
+ this.Loaded += PropertiesView_Loaded;
+ }
private void PropertiesView_Loaded(object sender, RoutedEventArgs e)
{
- DisplayProperties();
- }
+ DisplayProperties();
+ }
void PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- DisplayProperties();
- }
+ {
+ DisplayProperties();
+ }
- private void DisplayProperties()
- {
- _panel.Children.Clear();
- ClearGrid();
- if (SelectedObject != null)
- {
- int row = 0;
- foreach (var prop in SelectedObject.GetType().GetProperties())
- {
- var attr = prop.GetCustomAttributes(typeof(BrowsableAttribute), true);
- if (NeedBrowsable == false && (attr.Length == 0 || (attr[0] as BrowsableAttribute).Browsable))
- {
- DisplayProperty(prop, row);
- row++;
- }
- else if(NeedBrowsable == true && (attr.Length > 0 && (attr[0] as BrowsableAttribute).Browsable))
+ private void DisplayProperties()
+ {
+ _panel.Children.Clear();
+ ClearGrid();
+ if (SelectedObject != null)
+ {
+ if (CustomSetting == true)
+ {
+ if (SelectedObject.GetType().GetProperty("PropertiesSetting") != null)
{
- DisplayProperty(prop, row);
- row++;
+ Dictionary settings = SelectedObject.GetType().GetProperty("PropertiesSetting").GetValue(SelectedObject) as Dictionary;
+ int row = 0;
+ foreach (var setting in settings)
+ {
+ var prop = SelectedObject.GetType().GetProperty(setting.Key);
+ DisplayProperty(prop, row, setting.Value);
+ row++;
+ }
}
}
- _panel.Children.Add(_gridContainer);
- }
- else
- {
- _panel.Children.Add(_label);
- }
- }
+ else
+ {
+ int row = 0;
+ foreach (var prop in SelectedObject.GetType().GetProperties())
+ {
+ var attr = prop.GetCustomAttributes(typeof(BrowsableAttribute), true);
+ if (NeedBrowsable == false && (attr.Length == 0 || (attr[0] as BrowsableAttribute).Browsable))
+ {
+ DisplayProperty(prop, row);
+ row++;
+ }
+ else if (NeedBrowsable == true && (attr.Length > 0 && (attr[0] as BrowsableAttribute).Browsable))
+ {
+ DisplayProperty(prop, row);
+ row++;
+ }
+ }
+ }
+ _panel.Children.Add(_gridContainer);
+ }
+ else
+ {
+ _panel.Children.Add(_label);
+ }
+ }
- private void ClearGrid()
- {
- _grid.RowDefinitions.Clear();
- for (int i = _grid.Children.Count - 1; i >= 0; i--)
- {
- if (_grid.Children[i] != _vLine && _grid.Children[i] != _splitter)
- _grid.Children.RemoveAt(i);
- }
- }
+ private void ClearGrid()
+ {
+ _grid.RowDefinitions.Clear();
+ for (int i = _grid.Children.Count - 1; i >= 0; i--)
+ {
+ if (_grid.Children[i] != _vLine && _grid.Children[i] != _splitter)
+ _grid.Children.RemoveAt(i);
+ }
+ }
- private void DisplayProperty(PropertyInfo prop, int row)
- {
- var rowDef = new RowDefinition();
- rowDef.Height = new GridLength(Math.Max(20, this.FontSize * 2));
- _grid.RowDefinitions.Add(rowDef);
+ private void DisplayProperty(PropertyInfo prop, int row, string name = null)
+ {
+ var rowDef = new RowDefinition();
+ rowDef.Height = new GridLength(Math.Max(20, this.FontSize * 2));
+ _grid.RowDefinitions.Add(rowDef);
var tb = new TextBlock() { Text = prop.Name };
- var displayAttr = prop.GetCustomAttributes(typeof(DisplayNameAttribute), true);
- if (displayAttr.Length > 0 )
+ if (name != null)
{
- tb.Text = (displayAttr[0] as DisplayNameAttribute).DisplayName;
+ tb.Text = name;
+ tb.ToolTip = prop.Name;
}
+ else
+ {
+ var displayAttr = prop.GetCustomAttributes(typeof(DisplayNameAttribute), true);
+ if (displayAttr.Length > 0)
+ {
+ tb.Text = (displayAttr[0] as DisplayNameAttribute).DisplayName;
+ tb.ToolTip = prop.Name;
+ }
+ }
+
tb.Margin = new Thickness(4);
- tb.VerticalAlignment = VerticalAlignment.Center;
- Grid.SetColumn(tb, 0);
- Grid.SetRow(tb, _grid.RowDefinitions.Count - 1);
- _grid.Children.Add(tb);
+ Grid.SetColumn(tb, 0);
+ Grid.SetRow(tb, _grid.RowDefinitions.Count - 1);
+ _grid.Children.Add(tb);
- var line = new Line();
- line.Style = (Style)border.Resources["gridHorizontalLineStyle"];
- Grid.SetRow(line, row);
- _grid.Children.Add(line);
+ var line = new Line();
+ line.Style = (Style)border.Resources["gridHorizontalLineStyle"];
+ Grid.SetRow(line, row);
+ _grid.Children.Add(line);
- Style style = null;
- var styleNameAttr = prop.GetCustomAttributes(typeof(StyleNameAttribute), true);
- if (styleNameAttr.Length > 0)
- {
- style = this.FindResource((styleNameAttr[0] as StyleNameAttribute).Name) as Style;
- if (style != null)
- {
- ContentControl content = new ContentControl();
- content.Style = style;
- content.DataContext = SelectedObject;
+ Style style = null;
+ var styleNameAttr = prop.GetCustomAttributes(typeof(StyleNameAttribute), true);
+ if (styleNameAttr.Length > 0)
+ {
+ style = this.FindResource((styleNameAttr[0] as StyleNameAttribute).Name) as Style;
+ if (style != null)
+ {
+ ContentControl content = new ContentControl();
+ content.Style = style;
+ content.DataContext = SelectedObject;
- Grid.SetColumn(content, 1);
- Grid.SetRow(content, _grid.RowDefinitions.Count - 1);
+ Grid.SetColumn(content, 1);
+ Grid.SetRow(content, _grid.RowDefinitions.Count - 1);
- _grid.Children.Add(content);
- }
- }
-
- if (style == null)
- {
- var ed = new TextBox();
- ed.PreviewKeyDown += new KeyEventHandler(ed_KeyDown);
- ed.Margin = new Thickness(0);
- ed.VerticalAlignment = VerticalAlignment.Center;
- ed.BorderThickness = new Thickness(0);
- Grid.SetColumn(ed, 1);
- Grid.SetRow(ed, _grid.RowDefinitions.Count - 1);
+ _grid.Children.Add(content);
+ }
+ }
- var binding = new Binding(prop.Name);
- binding.Source = SelectedObject;
- binding.ValidatesOnExceptions = true;
- binding.Mode = BindingMode.OneWay;
- if (prop.CanWrite)
- {
- var mi = prop.GetSetMethod();
- if (mi != null && mi.IsPublic)
- binding.Mode = BindingMode.TwoWay;
- }
- ed.SetBinding(TextBox.TextProperty, binding);
+ if (style == null)
+ {
+ var ed = new TextBox();
+ ed.PreviewKeyDown += new KeyEventHandler(ed_KeyDown);
+ ed.Margin = new Thickness(0);
+ ed.VerticalAlignment = VerticalAlignment.Center;
+ ed.BorderThickness = new Thickness(0);
+ Grid.SetColumn(ed, 1);
+ Grid.SetRow(ed, _grid.RowDefinitions.Count - 1);
- var template = (ControlTemplate)border.Resources["validationErrorTemplate"];
- Validation.SetErrorTemplate(ed, template);
+ var binding = new Binding(prop.Name);
+ binding.Source = SelectedObject;
+ binding.ValidatesOnExceptions = true;
+ binding.Mode = BindingMode.OneWay;
+ if (prop.CanWrite)
+ {
+ var mi = prop.GetSetMethod();
+ if (mi != null && mi.IsPublic)
+ binding.Mode = BindingMode.TwoWay;
+ }
+ ed.SetBinding(TextBox.TextProperty, binding);
- _grid.Children.Add(ed);
- }
- }
+ var template = (ControlTemplate)border.Resources["validationErrorTemplate"];
+ Validation.SetErrorTemplate(ed, template);
- void ed_KeyDown(object sender, KeyEventArgs e)
- {
- var ed = sender as TextBox;
- if (ed != null)
- {
- if (e.Key == Key.Enter)
- {
- ed.GetBindingExpression(TextBox.TextProperty).UpdateSource();
- e.Handled = true;
- }
- else if (e.Key == Key.Escape)
- ed.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
- }
- }
- }
+ _grid.Children.Add(ed);
+ }
+ }
- [AttributeUsage(AttributeTargets.Property)]
- public class StyleNameAttribute : Attribute
- {
- private string _name;
- public StyleNameAttribute(string name)
- {
- _name = name;
- }
+ void ed_KeyDown(object sender, KeyEventArgs e)
+ {
+ var ed = sender as TextBox;
+ if (ed != null)
+ {
+ if (e.Key == Key.Enter)
+ {
+ ed.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ e.Handled = true;
+ }
+ else if (e.Key == Key.Escape)
+ ed.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
+ }
+ }
+ }
- public string Name
- {
- get { return _name; }
- }
- }
+ [AttributeUsage(AttributeTargets.Property)]
+ public class StyleNameAttribute : Attribute
+ {
+ private string _name;
+ public StyleNameAttribute(string name)
+ {
+ _name = name;
+ }
+
+ public string Name
+ {
+ get
+ {
+ return _name;
+ }
+ }
+ }
}
diff --git a/AIStudio.Wpf.Flowchart/ViewModels/FlowNode.cs b/AIStudio.Wpf.Flowchart/ViewModels/FlowNode.cs
index 50170c1..781a063 100644
--- a/AIStudio.Wpf.Flowchart/ViewModels/FlowNode.cs
+++ b/AIStudio.Wpf.Flowchart/ViewModels/FlowNode.cs
@@ -96,6 +96,17 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
public string NextStepId { get; set; }
public Dictionary SelectNextStep { get; set; } = new Dictionary();
#endregion
+
+ public virtual Dictionary PropertiesSetting
+ {
+ get
+ {
+ return new Dictionary()
+ {
+ { "Text","文本" },
+ };
+ }
+ }
}
public class StartFlowNode : FlowNode
diff --git a/AIStudio.Wpf.Flowchart/ViewModels/MiddleFlowNode.cs b/AIStudio.Wpf.Flowchart/ViewModels/MiddleFlowNode.cs
index e5d8d8f..52504be 100644
--- a/AIStudio.Wpf.Flowchart/ViewModels/MiddleFlowNode.cs
+++ b/AIStudio.Wpf.Flowchart/ViewModels/MiddleFlowNode.cs
@@ -23,7 +23,10 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
[StyleName("UserIdsStyle")]
public List UserIds
{
- get { return _userIds; }
+ get
+ {
+ return _userIds;
+ }
set
{
SetProperty(ref _userIds, value);
@@ -35,7 +38,10 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
[StyleName("RoleIdsStyle")]
public List RoleIds
{
- get { return _roleIds; }
+ get
+ {
+ return _roleIds;
+ }
set
{
SetProperty(ref _roleIds, value);
@@ -47,7 +53,10 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
[StyleName("ActTypeStyle")]
public string ActType
{
- get { return _actType; }
+ get
+ {
+ return _actType;
+ }
set
{
SetProperty(ref _actType, value);
@@ -72,6 +81,18 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
}
-
+ public override Dictionary PropertiesSetting
+ {
+ get
+ {
+ return new Dictionary()
+ {
+ { "Text","文本" },
+ {"UserIds", "用户" },
+ {"RoleIds", "角色" },
+ {"ActType", "or/and" }
+ };
+ }
+ }
}
}