|
@@ -213,10 +213,12 @@ namespace Aitex.UI.RecipeEditor
|
|
|
ColumnDefinition col1 = new ColumnDefinition();
|
|
|
//col1.MinWidth = 50;
|
|
|
grid.ColumnDefinitions.Insert(index,col1);
|
|
|
-
|
|
|
+ Binding stepcheckbinding = null;
|
|
|
+
|
|
|
//grid.MinWidth = 200;
|
|
|
foreach (PropertyInfo propertyInfo in recipeType.GetProperties())
|
|
|
{
|
|
|
+
|
|
|
string propertyInfoName = propertyInfo.Name;
|
|
|
string propertyTypeName = propertyInfo.PropertyType.Name;
|
|
|
if (propertyInfoName != "LstUnit")
|
|
@@ -246,12 +248,19 @@ namespace Aitex.UI.RecipeEditor
|
|
|
Mode = BindingMode.TwoWay, // 绑定模式
|
|
|
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged //触发器
|
|
|
};
|
|
|
-
|
|
|
switch (propertyTypeName)
|
|
|
{
|
|
|
case "Int32":
|
|
|
case "String":
|
|
|
TextBox textBox = new TextBox();
|
|
|
+ if (stepcheckbinding == null)
|
|
|
+ {
|
|
|
+ textBox.IsEnabled = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ textBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
|
|
|
+ }
|
|
|
textBox.SetBinding(TextBox.TextProperty, binding);
|
|
|
grid.Children.Add(textBox);
|
|
|
Grid.SetRow(textBox, i);
|
|
@@ -296,6 +305,30 @@ namespace Aitex.UI.RecipeEditor
|
|
|
grid.Children.Add(checkBox);
|
|
|
Grid.SetRow(checkBox, i);
|
|
|
Grid.SetColumn(checkBox, index + location);
|
|
|
+
|
|
|
+ if (stepcheckbinding == null)
|
|
|
+ {
|
|
|
+ stepcheckbinding = new Binding
|
|
|
+ {
|
|
|
+ Source = checkBox, // 数据源
|
|
|
+ Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名
|
|
|
+ Mode = BindingMode.TwoWay, // 绑定模式
|
|
|
+ UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged //触发器
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (stepcheckbinding == null)
|
|
|
+ {
|
|
|
+ checkBox.IsEnabled = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ checkBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -306,6 +339,15 @@ namespace Aitex.UI.RecipeEditor
|
|
|
grid.Children.Add(comboBox);
|
|
|
Grid.SetRow(comboBox, i);
|
|
|
Grid.SetColumn(comboBox, index + location);
|
|
|
+
|
|
|
+ if (stepcheckbinding == null)
|
|
|
+ {
|
|
|
+ comboBox.IsEnabled = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ comboBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -388,13 +430,17 @@ namespace Aitex.UI.RecipeEditor
|
|
|
|
|
|
case "Boolean":
|
|
|
CheckBox checkBox = new CheckBox();
|
|
|
- checkbinding = new Binding
|
|
|
+ if (checkbinding == null)
|
|
|
{
|
|
|
- Source = checkBox, // 数据源
|
|
|
- Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名
|
|
|
- Mode = BindingMode.TwoWay, // 绑定模式
|
|
|
- UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged //触发器
|
|
|
- };
|
|
|
+ checkbinding = new Binding
|
|
|
+ {
|
|
|
+ Source = checkBox, // 数据源
|
|
|
+ Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名
|
|
|
+ Mode = BindingMode.TwoWay, // 绑定模式
|
|
|
+ UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged //触发器
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
checkBox.SetBinding(CheckBox.IsCheckedProperty, binding);
|
|
|
grid.Children.Add(checkBox);
|
|
|
Grid.SetRow(checkBox, i);
|