<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:pages="clr-namespace:DHT.Desktop.Main.Pages"
             xmlns:controls="clr-namespace:DHT.Desktop.Main.Controls"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="DHT.Desktop.Main.Pages.ViewerPage"
             AttachedToVisualTree="OnAttachedToVisualTree"
             DetachedFromVisualTree="OnDetachedFromVisualTree">

    <Design.DataContext>
        <pages:ViewerPageModel />
    </Design.DataContext>

    <UserControl.Styles>
        <Style Selector="Expander">
            <Setter Property="Margin" Value="0 25 0 0" />
        </Style>
    </UserControl.Styles>

    <StackPanel Orientation="Vertical">
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
            <Button Command="{Binding OnClickOpenViewer}" Margin="0 0 5 0">Open Viewer</Button>
            <Button Command="{Binding OnClickSaveViewer}" Margin="5 0 0 0">Save Viewer</Button>
        </StackPanel>
        <TextBlock Text="{Binding ExportedMessageText}" Margin="0 20 0 0" />
        <controls:FilterPanel DataContext="{Binding FilterModel}" />
        <Expander Header="Database Tools">
            <StackPanel Orientation="Vertical" Spacing="10">
                <StackPanel Orientation="Vertical" Spacing="4">
                    <RadioButton GroupName="DatabaseToolFilterMode" IsEnabled="{Binding HasFilters}" IsChecked="{Binding DatabaseToolFilterModeKeep}">Keep Only Messages Matching Filters</RadioButton>
                    <RadioButton GroupName="DatabaseToolFilterMode" IsEnabled="{Binding HasFilters}" IsChecked="{Binding DatabaseToolFilterModeRemove}">Remove Messages Matching Filters</RadioButton>
                </StackPanel>
                <Button IsEnabled="{Binding HasFilters}" Command="{Binding OnClickApplyFiltersToDatabase}">Apply Filters to Database</Button>
            </StackPanel>
        </Expander>
    </StackPanel>

</UserControl>
