Sic.Framework-Nanjing-Baishi/MECF.Framework.UI.Core/DeviceControl/EventLogComboView.xaml

53 lines
3.0 KiB
XML

<UserControl x:Class="MECF.Framework.UI.Core.DeviceControl.EventLogComboView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.UI.Core.DeviceControl"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<local:DateTimeToTextConverter x:Key="dateTimeToTextConverter"/>
<local:CollectionLastIndexConverter x:Key="collectionLastIndexConverter" />
</UserControl.Resources>
<ComboBox ItemsSource="{Binding EventLogList}"
SelectedIndex="{Binding EventLogList.Count,Mode=OneWay,Converter={StaticResource collectionLastIndexConverter}}"
VerticalContentAlignment="Center" FontSize="20" Height="35" >
<ComboBox.ItemTemplate>
<DataTemplate>
<ContentControl>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Background" Value="#F0F0F0"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Level}" Value="Alarm">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding Level}" Value="Warning">
<Setter Property="Foreground" Value="#FF8C00"/>
</DataTrigger>
<DataTrigger Binding="{Binding Level}" Value="Information">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="8,0,0,0" Grid.Column="0" Text="{Binding OccuringTime, Converter={StaticResource dateTimeToTextConverter}}" />
<TextBlock Grid.Column="2" Text="{Binding Id}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="1" Text="{Binding Source}" Margin="8,0,0,0" />
<TextBlock Grid.Column="3" Text="{Binding Description}" Margin="8,0,0,0"/>
</Grid>
</ContentControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</UserControl>