Browse Source

8

样式分支
fyf 2 years ago
parent
commit
d71be1b6c1
2 changed files with 14 additions and 13 deletions
  1. +10
    -6
      BeDesignerSCADA/MainWindow.xaml
  2. +4
    -7
      BeDesignerSCADA/MainWindow.xaml.cs

+ 10
- 6
BeDesignerSCADA/MainWindow.xaml View File

@@ -28,12 +28,16 @@
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition Width="350"/> <ColumnDefinition Width="350"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--<icon:PackIconMaterial x:Name="icon" Kind="LineScan" BorderThickness="1" VerticalAlignment="Stretch" Width="24" HorizontalAlignment="Stretch"/>-->
<!--左侧控件栏-->
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
<ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove">
</ListBox>
</Border>

<!--左侧选择区域-->
<Grid >
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
<ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove">
</ListBox>
</Border>
</Grid>


<!--中间控制区域--> <!--中间控制区域-->
<DockPanel Grid.Column="1"> <DockPanel Grid.Column="1">


+ 4
- 7
BeDesignerSCADA/MainWindow.xaml.cs View File

@@ -367,10 +367,8 @@ namespace BeDesignerSCADA
{ {
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; 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}" + "}"; propertyGridCommand.Value = "{" + $"Binding {toggle.Tag}.{toggle.Text}" + "}";
else
propertyGridCommand.Value = "{" + $"Binding {toggle.Tag}." + "}";
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -389,7 +387,6 @@ namespace BeDesignerSCADA
try try
{ {
viewModel.DevValueList = new System.Collections.ObjectModel.ObservableCollection<string>(); viewModel.DevValueList = new System.Collections.ObjectModel.ObservableCollection<string>();

if (sender is System.Windows.Controls.ComboBox) if (sender is System.Windows.Controls.ComboBox)
{ {
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
@@ -406,6 +403,7 @@ namespace BeDesignerSCADA
} }
} }

/// <summary> /// <summary>
/// 设备名称选择 /// 设备名称选择
/// </summary> /// </summary>
@@ -419,9 +417,9 @@ namespace BeDesignerSCADA
{ {
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; 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}" + "}"; propertyGridCommand.Value = "{" + $"Binding {toggle.Text}.{toggle.Tag}" + "}";
else
else if(!string.IsNullOrEmpty(toggle.Text))
propertyGridCommand.Value = "{" + $"Binding {toggle.Text}." + "}"; propertyGridCommand.Value = "{" + $"Binding {toggle.Text}." + "}";


} }
@@ -432,7 +430,6 @@ namespace BeDesignerSCADA
} }
} }



private void namebox_DropDownOpened(object sender,EventArgs e) private void namebox_DropDownOpened(object sender,EventArgs e)
{ {
viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>(); viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>();


Loading…
Cancel
Save