<reactiveui:ReactiveUserControl
    x:Class="v2rayN.Views.ClashConnectionsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:reactiveui="http://reactiveui.net"
    xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
    xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
    d:DesignHeight="450"
    d:DesignWidth="800"
    x:TypeArguments="vms:ClashConnectionsViewModel"
    mc:Ignorable="d">

    <DockPanel Margin="{StaticResource Margin4}">
        <WrapPanel
            Margin="{StaticResource Margin8}"
            VerticalAlignment="Center"
            DockPanel.Dock="Top"
            Orientation="Horizontal">

            <TextBox
                x:Name="txtHostFilter"
                Width="200"
                Margin="{StaticResource MarginLeftRight8}"
                VerticalContentAlignment="Center"
                materialDesign:HintAssist.Hint="{x:Static resx:ResUI.ConnectionsHostFilterTitle}"
                materialDesign:TextFieldAssist.HasClearButton="True"
                Style="{StaticResource DefTextBox}" />

            <Button
                x:Name="btnConnectionCloseAll"
                Width="24"
                Height="24"
                Margin="{StaticResource MarginLeftRight8}"
                Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
                ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
                <materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
            </Button>

            <Button
                x:Name="btnAutofitColumnWidth"
                Width="24"
                Height="24"
                Margin="{StaticResource MarginLeftRight8}"
                Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
                ToolTip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}">
                <materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowSplitVertical" />
            </Button>

            <TextBlock
                Margin="{StaticResource MarginLeftRight8}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}"
                Text="{x:Static resx:ResUI.TbAutoRefresh}" />
            <ToggleButton
                x:Name="togAutoRefresh"
                Margin="{StaticResource MarginLeftRight8}"
                HorizontalAlignment="Left" />
        </WrapPanel>

        <DataGrid
            x:Name="lstConnections"
            AutoGenerateColumns="False"
            BorderThickness="1"
            CanUserAddRows="False"
            CanUserResizeRows="False"
            EnableRowVirtualization="True"
            GridLinesVisibility="All"
            HeadersVisibility="Column"
            IsReadOnly="True"
            Style="{StaticResource DefDataGrid}">
            <DataGrid.ContextMenu>
                <ContextMenu Style="{StaticResource DefContextMenu}">
                    <MenuItem x:Name="menuConnectionClose" Header="{x:Static resx:ResUI.menuConnectionClose}" />
                    <MenuItem x:Name="menuConnectionCloseAll" Header="{x:Static resx:ResUI.menuConnectionCloseAll}" />
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTextColumn
                    Width="300"
                    Binding="{Binding Host}"
                    Header="{x:Static resx:ResUI.TbSortingHost}" />
                <DataGridTextColumn
                    Width="500"
                    Binding="{Binding Chain}"
                    Header="{x:Static resx:ResUI.TbSortingChain}" />
                <DataGridTextColumn
                    Width="80"
                    Binding="{Binding Network}"
                    Header="{x:Static resx:ResUI.TbSortingNetwork}" />
                <DataGridTextColumn
                    Width="160"
                    Binding="{Binding Type}"
                    Header="{x:Static resx:ResUI.TbSortingType}" />
                <DataGridTextColumn
                    Width="100"
                    Binding="{Binding Elapsed}"
                    Header="{x:Static resx:ResUI.TbSortingTime}" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</reactiveui:ReactiveUserControl>
