<base:WindowBase
    x:Class="v2rayN.Views.RoutingSettingWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="clr-namespace:v2rayN.Base"
    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"
    Title="{x:Static resx:ResUI.menuRoutingSetting}"
    Width="1000"
    Height="700"
    x:TypeArguments="vms:RoutingSettingViewModel"
    ResizeMode="CanResize"
    ShowInTaskbar="False"
    Style="{StaticResource WindowGlobal}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Window.Resources>
        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                ClipToBounds="True"
                Style="{StaticResource MaterialDesignToolBar}">
                <Button x:Name="menuRoutingAdvancedAdd2">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Plus" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
                    </StackPanel>
                </Button>
                <Separator />
                <Button x:Name="menuRoutingAdvancedImportRules2">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Import" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
                    </StackPanel>
                </Button>
            </ToolBar>
        </ToolBarTray>

        <StackPanel
            Margin="{StaticResource Margin8}"
            HorizontalAlignment="Right"
            DockPanel.Dock="Bottom"
            Orientation="Horizontal">
            <Button
                x:Name="btnSave"
                Width="100"
                Content="{x:Static resx:ResUI.TbConfirm}"
                IsDefault="True"
                Style="{StaticResource DefButton}" />
            <Button
                x:Name="btnCancel"
                Width="100"
                Margin="{StaticResource MarginLeftRight8}"
                Content="{x:Static resx:ResUI.TbCancel}"
                IsCancel="true"
                Style="{StaticResource DefButton}" />
        </StackPanel>

        <Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock
                Grid.Row="0"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}">
                <Hyperlink Click="linkdomainStrategy_Click">
                    <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" />
                    <materialDesign:PackIcon Kind="Link" />
                </Hyperlink>
            </TextBlock>
            <ComboBox
                x:Name="cmbdomainStrategy"
                Grid.Row="0"
                Grid.Column="1"
                Width="300"
                Margin="{StaticResource Margin4}"
                Style="{StaticResource DefComboBox}" />

            <TextBlock
                Grid.Row="1"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}">
                <Hyperlink Click="linkdomainStrategy4Singbox_Click">
                    <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
                    <materialDesign:PackIcon Kind="Link" />
                </Hyperlink>
            </TextBlock>
            <ComboBox
                x:Name="cmbdomainStrategy4Singbox"
                Grid.Row="1"
                Grid.Column="1"
                Width="300"
                Margin="{StaticResource Margin4}"
                Style="{StaticResource DefComboBox}" />
        </Grid>

        <TabControl x:Name="tabAdvanced">
            <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRoutingTabRuleList}">
                <DataGrid
                    x:Name="lstRoutings"
                    AutoGenerateColumns="False"
                    BorderThickness="1"
                    CanUserAddRows="False"
                    CanUserResizeRows="False"
                    CanUserSortColumns="False"
                    EnableRowVirtualization="True"
                    GridLinesVisibility="All"
                    HeadersVisibility="Column"
                    IsReadOnly="True"
                    Style="{StaticResource DefDataGrid}">
                    <DataGrid.ContextMenu>
                        <ContextMenu Style="{StaticResource DefContextMenu}">
                            <MenuItem
                                x:Name="menuRoutingAdvancedAdd"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
                            <MenuItem
                                x:Name="menuRoutingAdvancedRemove"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRoutingAdvancedRemove}" />
                            <MenuItem
                                x:Name="menuRoutingAdvancedSelectAll"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuSelectAll}" />
                            <MenuItem
                                x:Name="menuRoutingAdvancedSetDefault"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRoutingAdvancedSetDefault}" />
                            <Separator />
                            <MenuItem
                                x:Name="menuRoutingAdvancedImportRules"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
                        </ContextMenu>
                    </DataGrid.ContextMenu>
                    <DataGrid.Resources>
                        <Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsActive}" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
                                    <Setter Property="Foreground" Value="Black" />
                                    <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </DataGrid.Resources>
                    <DataGrid.Columns>
                        <DataGridTextColumn
                            Width="*"
                            Binding="{Binding Remarks}"
                            Header="{x:Static resx:ResUI.LvRemarks}" />
                        <DataGridTextColumn
                            Width="60"
                            Binding="{Binding RuleNum}"
                            Header="{x:Static resx:ResUI.LvCount}" />
                        <DataGridTextColumn
                            Width="60"
                            Binding="{Binding Sort}"
                            Header="{x:Static resx:ResUI.LvSort}" />
                        <DataGridTextColumn
                            Width="*"
                            Binding="{Binding Url}"
                            Header="{x:Static resx:ResUI.LvUrl}" />
                        <DataGridTextColumn
                            Width="300"
                            Binding="{Binding CustomIcon}"
                            Header="{x:Static resx:ResUI.LvCustomIcon}" />
                    </DataGrid.Columns>
                </DataGrid>
            </TabItem>
        </TabControl>
    </DockPanel>
</base:WindowBase>
