<UserControl 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="clr-namespace:PacketLogger.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="PacketLogger.Views.Log.PacketLogView"
xmlns:i="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
xmlns:converters="clr-namespace:PacketLogger.Converters"
xmlns:views="clr-namespace:PacketLogger.Views"
xmlns:packets="clr-namespace:PacketLogger.Models.Packets"
xmlns:packetLogger="clr-namespace:PacketLogger"
xmlns:log="clr-namespace:PacketLogger.ViewModels.Log"
x:Name="UserControl">
<UserControl.Resources>
<converters:PacketSourceConverter x:Key="packetSourceConverter" />
</UserControl.Resources>
<Design.DataContext>
<log:PacketLogViewModel />
</Design.DataContext>
<SplitView OpenPaneLength="300" IsPaneOpen="{Binding PaneOpen, Mode = TwoWay}" DisplayMode="CompactInline"
PanePlacement="Right">
<SplitView.Pane>
<Grid Width="280" HorizontalAlignment="Left"
ColumnDefinitions="*" RowDefinitions="Auto,*,Auto" Margin="10">
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Stretch">
<Button Grid.Row="0" Margin="0,1,0,0" VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch" Width="22" Height="22"
Command="{Binding TogglePane}">
<Grid>
<i:Icon Value="mdi-menu-left" Height="22" Width="22" Margin="0,0,2,0"
IsVisible="{Binding !PaneOpen}" />
<i:Icon Value="mdi-menu-right" Height="22" Width="22" IsVisible="{Binding PaneOpen}" />
</Grid>
</Button>
<TextBlock VerticalAlignment="Center" FontSize="30" Text="Filter"
Margin="5,0,0,0" />
<ComboBox Width="160" Margin="10,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Stretch"
Items="{Binding Profiles.SelectableProfiles}" SelectedItem="{Binding FilterChoose.CurrentProfile, Mode = TwoWay}">
<ComboBox.DataTemplates>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.DataTemplates>
</ComboBox>
</StackPanel>
<ContentControl Grid.Row="1" Content="{Binding FilterChoose}" />
<Grid Grid.Row="2" RowDefinitions="40,40" ColumnDefinitions="140,140">
<CheckBox Grid.Row="0" Grid.Column="0" Content="Log received" IsChecked="{Binding LogReceived}" />
<CheckBox Grid.Row="0" Grid.Column="1" Content="Log sent" IsChecked="{Binding LogSent}" />
<CheckBox Grid.Row="1" Grid.Column="0" Content="Scroll" IsChecked="{Binding Scroll}" />
<Button Grid.Row="1" Grid.Column="1" Content="Clear" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center" Command="{Binding Clear}" />
</Grid>
</Grid>
</SplitView.Pane>
<ListBox Items="{Binding FilteredPackets}"
x:Name="PacketsLog"
SelectionMode="Multiple"
SelectedItem="{Binding SelectedPacket, Mode=TwoWay}"
VerticalAlignment="Stretch"
SelectionChanged="PacketsLog_OnSelectionChanged">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="1" />
</Style>
<Style Selector="TextBlock">
<Setter Property="FontSize" Value="12" />
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Height="16" Margin="0" Orientation="Horizontal">
<TextBlock Width="60" Text="{Binding Date, StringFormat = {}{0:HH:mm:ss}}" />
<TextBlock Width="40"
Text="{Binding Source, Converter = {StaticResource packetSourceConverter}}">
</TextBlock>
<Border ToolTip.Tip="{Binding PacketString}">
<TextBlock VerticalAlignment="Center" Text="{Binding PacketString}"
TextTrimming="CharacterEllipsis">
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ContextMenu>
<ContextMenu Name="PacketMenu">
<MenuItem Header="Copy packets" Command="{Binding CopyPackets}"
CommandParameter="{Binding ElementName=PacketsLog, Path=SelectedItems}" IsEnabled="True">
</MenuItem>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
</SplitView>
</UserControl>