修正主窗体中LOG下拉框可能被撑的很大的问题。

This commit is contained in:
DESKTOP-1N1NK8A\auvkk 2023-04-19 15:46:41 +08:00
parent b7a0b6d618
commit 4c9f22851a
1 changed files with 59 additions and 2 deletions

View File

@ -1,4 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core">
<Style x:Key="ComboBoxFocusVisual">
<Setter Property="Control.Template">
@ -709,6 +710,14 @@
<!-- Top ComboBox Style -->
<deviceControl:DateTimeToTextConverter x:Key="dateTimeToTextConverter" />
<SolidColorBrush x:Key="MessagesErrorForegroundBrush" Color="Red" />
<SolidColorBrush x:Key="MessagesWarningForegroundBrush" Color="#FF8C00" />
<SolidColorBrush x:Key="MessagesInformationForegroundBrush" Color="Black" />
<SolidColorBrush x:Key="MessagesInformationBackgroundBrush" Color="#FFC8E8FF" />
<SolidColorBrush x:Key="MessagesHorizontalGridLinesBrush" Color="LightGray" />
<Style x:Key="Top_ComboBox" TargetType="{x:Type ComboBox}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
@ -723,6 +732,54 @@
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<ContentControl>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Background" Value="{StaticResource MessagesInformationBackgroundBrush}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Level}" Value="Alarm">
<Setter Property="Foreground" Value="{StaticResource MessagesErrorForegroundBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding Level}" Value="Warning">
<Setter Property="Foreground" Value="{StaticResource MessagesWarningForegroundBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding Level}" Value="Information">
<Setter Property="Foreground" Value="{StaticResource MessagesInformationForegroundBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="110" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Margin="8,0,0,0"
Text="{Binding OccuringTime, Converter={StaticResource dateTimeToTextConverter}}" />
<TextBlock
Grid.Column="2"
Margin="8,0,0,0"
Text="{Binding Id}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
Text="{Binding Source}" />
<TextBlock
Grid.Column="3"
Margin="8,0,0,0"
Text="{Binding Description}"/>
</Grid>
</ContentControl>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
@ -742,7 +799,7 @@
VerticalOffset="2">
<Border
x:Name="DropDownBorder"
MinWidth="{TemplateBinding ActualWidth}"
Width="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"