EventLogComboView.xaml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <UserControl x:Class="MECF.Framework.UI.Core.DeviceControl.EventLogComboView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:MECF.Framework.UI.Core.DeviceControl"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="800">
  9. <UserControl.Resources>
  10. <local:DateTimeToTextConverter x:Key="dateTimeToTextConverter"/>
  11. <local:CollectionLastIndexConverter x:Key="collectionLastIndexConverter" />
  12. </UserControl.Resources>
  13. <ComboBox ItemsSource="{Binding EventLogList}"
  14. SelectedIndex="{Binding EventLogList.Count,Mode=OneWay,Converter={StaticResource collectionLastIndexConverter}}"
  15. VerticalContentAlignment="Center" FontSize="20" Height="35" >
  16. <ComboBox.ItemTemplate>
  17. <DataTemplate>
  18. <ContentControl>
  19. <ContentControl.Style>
  20. <Style TargetType="ContentControl">
  21. <Setter Property="Background" Value="#F0F0F0"/>
  22. <Style.Triggers>
  23. <DataTrigger Binding="{Binding Level}" Value="Alarm">
  24. <Setter Property="Foreground" Value="Red"/>
  25. </DataTrigger>
  26. <DataTrigger Binding="{Binding Level}" Value="Warning">
  27. <Setter Property="Foreground" Value="#FF8C00"/>
  28. </DataTrigger>
  29. <DataTrigger Binding="{Binding Level}" Value="Information">
  30. <Setter Property="Foreground" Value="Black"/>
  31. </DataTrigger>
  32. </Style.Triggers>
  33. </Style>
  34. </ContentControl.Style>
  35. <Grid>
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="130"/>
  38. <ColumnDefinition Width="120"/>
  39. <ColumnDefinition Width="60"/>
  40. <ColumnDefinition Width="*"/>
  41. </Grid.ColumnDefinitions>
  42. <TextBlock Margin="8,0,0,0" Grid.Column="0" Text="{Binding OccuringTime, Converter={StaticResource dateTimeToTextConverter}}" />
  43. <TextBlock Grid.Column="2" Text="{Binding Id}" Margin="8,0,0,0"/>
  44. <TextBlock Grid.Column="1" Text="{Binding Source}" Margin="8,0,0,0" />
  45. <TextBlock Grid.Column="3" Text="{Binding Description}" Margin="8,0,0,0"/>
  46. </Grid>
  47. </ContentControl>
  48. </DataTemplate>
  49. </ComboBox.ItemTemplate>
  50. </ComboBox>
  51. </UserControl>