Browse Source

调整焦点问题

样式分支
fyf 2 years ago
parent
commit
8377971a2e
5 changed files with 29 additions and 7 deletions
  1. +3
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
  2. +6
    -0
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  3. +3
    -3
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml
  4. +3
    -3
      BeDesignerSCADA/MainWindow.xaml
  5. +14
    -0
      BeDesignerSCADA/MainWindow.xaml.cs

+ 3
- 1
BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs View File

@@ -31,8 +31,10 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheTextBlock()
{
ResourceDictionary languageResDic = new ResourceDictionary();
languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute);
this.Resources.MergedDictionaries.Add(languageResDic);
Height = 30;
Width = 80;
}

public string ControlType => "控件";


+ 6
- 0
BPASmartClient.SCADAControl/Themes/Generic.xaml View File

@@ -491,6 +491,12 @@
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="20" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="TextWrapping" Value="Wrap"/>
</Style.Setters>
</Style>



+ 3
- 3
BeDesignerSCADA/Controls/MainCanvasPanel.xaml View File

@@ -267,13 +267,13 @@
<ColumnDefinition Width="*" x:Name="Text"/>
</Grid.ColumnDefinitions>
<TextBlock>绑定:</TextBlock>
<ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" Width="{Binding Width, ElementName=key}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
<ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevNameList}">
</ComboBox>
<ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" Width="{Binding Width, ElementName=Text}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
<ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevValueList}"/>
</Grid>
<TextBox Grid.Row="2" x:Name="wenben" Width="{Binding Width, ElementName=Text}" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
<TextBox Grid.Row="2" x:Name="wenben" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>

</Grid>
</DataTemplate>


+ 3
- 3
BeDesignerSCADA/MainWindow.xaml View File

@@ -271,13 +271,13 @@
<ColumnDefinition Width="*" x:Name="Text"/>
</Grid.ColumnDefinitions>
<TextBlock>绑定:</TextBlock>
<ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" Width="{Binding Width, ElementName=key}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
<ComboBox x:Name="namebox" DropDownOpened="namebox_DropDownOpened" Grid.Column="1" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=valuebox}" TextBoxBase.TextChanged="ComboBoxName_TextChanged"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevNameList}">
</ComboBox>
<ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" Width="{Binding Width, ElementName=Text}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
<ComboBox x:Name="valuebox" DropDownOpened="valuebox_DropDownOpened" Grid.Column="2" Height="25" IsTextSearchEnabled="True" IsEditable="True" Tag="{Binding Text, ElementName=namebox}" TextBoxBase.TextChanged="ComboBoxValue_TextChanged"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window},Path=DataContext.DevValueList}"/>
</Grid>
<TextBox Grid.Row="2" x:Name="wenben" Width="{Binding Width, ElementName=Text}" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
<TextBox Grid.Row="2" x:Name="wenben" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox>
</Grid>
</DataTemplate>


+ 14
- 0
BeDesignerSCADA/MainWindow.xaml.cs View File

@@ -44,6 +44,20 @@ namespace BeDesignerSCADA
Assembly assembly = Assembly.LoadFile($"{System.AppDomain.CurrentDomain.BaseDirectory}\\BPASmartClient.SCADAControl.dll"); //Assembly.GetExecutingAssembly();
var controls = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o=>o.Name);
CtlList.ItemsSource = controls;
this.GotFocus += MainWindow_GotFocus;
this.LostFocus += MainWindow_LostFocus;
}

private void MainWindow_LostFocus(object sender, RoutedEventArgs e)
{
System.Diagnostics.Trace.WriteLine("失去焦点:" + e.OriginalSource.ToString());
// Console.WriteLine(e.OriginalSource.ToString());
}

private void MainWindow_GotFocus(object sender, RoutedEventArgs e)
{
System.Diagnostics.Trace.WriteLine("获得焦点:"+e.OriginalSource.ToString());

}

#region 加载数据中心与事件中心


Loading…
Cancel
Save