12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <UserControl
- x:Class="ShakerApp.Views.LogsView"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="using:ShakerApp.ViewModels"
- d:DesignHeight="450"
- d:DesignWidth="800"
- x:DataType="vm:LogViewModel"
- Background="Transparent"
- DataContext="{Binding Source={x:Static vm:LogViewModel.Instance}}"
- mc:Ignorable="d">
- <StackPanel Background="Transparent">
- <Grid
- Height="{StaticResource ItemHeight}"
- Background="LightGray"
- ColumnDefinitions="40,0.5*,*">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{DynamicResource ServoValveIndex}" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{DynamicResource Time}" />
- <TextBlock
- Grid.Column="2"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{DynamicResource Message}" />
- </Grid>
- <ScrollViewer Height="{Binding $parent.Bounds.Height, Converter={StaticResource SubtractionConverter}, ConverterParameter={StaticResource ItemHeight}}">
- <ItemsControl ItemsSource="{Binding Logs}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid Height="{StaticResource ItemHeight}" ColumnDefinitions="40,0.5*,*">
- <Grid.Styles>
- <Style Selector="TextBlock.Error">
- <Setter Property="Foreground" Value="Red" />
- </Style>
- </Grid.Styles>
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Classes.Error="{Binding Value.LogType, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static vm:LogType.Error}}"
- Text="{Binding Index}" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Classes.Error="{Binding Value.LogType, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static vm:LogType.Error}}"
- Text="{Binding Value.DateTime, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss.fff}'}" />
- <TextBlock
- Grid.Column="2"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Classes.Error="{Binding Value.LogType, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static vm:LogType.Error}}"
- Text="{Binding Value.Message}" />
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </StackPanel>
- </UserControl>
|