diff --git a/BeDesignerSCADA/MainWindow.xaml b/BeDesignerSCADA/MainWindow.xaml index 3ab8cdae..aad1d999 100644 --- a/BeDesignerSCADA/MainWindow.xaml +++ b/BeDesignerSCADA/MainWindow.xaml @@ -28,12 +28,16 @@ - - - - - - + + + + + + + + + + diff --git a/BeDesignerSCADA/MainWindow.xaml.cs b/BeDesignerSCADA/MainWindow.xaml.cs index d3764929..0adaeee1 100644 --- a/BeDesignerSCADA/MainWindow.xaml.cs +++ b/BeDesignerSCADA/MainWindow.xaml.cs @@ -367,10 +367,8 @@ namespace BeDesignerSCADA { System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; - if (toggle.Tag != null) + if (toggle.Tag != null && !string.IsNullOrEmpty(toggle.Text)) propertyGridCommand.Value = "{" + $"Binding {toggle.Tag}.{toggle.Text}" + "}"; - else - propertyGridCommand.Value = "{" + $"Binding {toggle.Tag}." + "}"; } } catch (Exception ex) @@ -389,7 +387,6 @@ namespace BeDesignerSCADA try { viewModel.DevValueList = new System.Collections.ObjectModel.ObservableCollection(); - if (sender is System.Windows.Controls.ComboBox) { System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; @@ -406,6 +403,7 @@ namespace BeDesignerSCADA } } + /// /// 设备名称选择 /// @@ -419,9 +417,9 @@ namespace BeDesignerSCADA { System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; - if(toggle.Tag!=null) + if(toggle.Tag!=null && !string.IsNullOrEmpty(toggle.Text)) propertyGridCommand.Value = "{" + $"Binding {toggle.Text}.{toggle.Tag}" + "}"; - else + else if(!string.IsNullOrEmpty(toggle.Text)) propertyGridCommand.Value = "{" + $"Binding {toggle.Text}." + "}"; } @@ -432,7 +430,6 @@ namespace BeDesignerSCADA } } - private void namebox_DropDownOpened(object sender,EventArgs e) { viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection();