<Window
    x:Class="v2rayN.Desktop.Views.RoutingSettingWindow"
    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: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:DataType="vms:RoutingSettingViewModel"
    ShowInTaskbar="False"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">

    <DockPanel>
        <StackPanel
            Classes="Margin8"
            DockPanel.Dock="Top"
            Orientation="Horizontal">
            <Menu>
                <MenuItem x:Name="menuRoutingAdvancedAdd2" Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
                <MenuItem x:Name="menuRoutingAdvancedImportRules2" Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
            </Menu>

            <TextBlock Margin="8,0,0,0" VerticalAlignment="Center">
                <HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy_Click">
                    <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" />
                </HyperlinkButton>
            </TextBlock>
            <ComboBox
                x:Name="cmbdomainStrategy"
                Width="110"
                Margin="8,0,0,0" />
            <Separator />
            <TextBlock
                Margin="8,0,0,0"
                VerticalAlignment="Center"
                Text="{x:Static resx:ResUI.TbdomainMatcher}" />
            <ComboBox
                x:Name="cmbdomainMatcher"
                Width="60"
                Margin="8,0,0,0" />
            <Separator />
            <TextBlock Margin="8,0,0,0" VerticalAlignment="Center">
                <HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy4Singbox_Click">
                    <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
                </HyperlinkButton>
            </TextBlock>
            <ComboBox
                x:Name="cmbdomainStrategy4Singbox"
                Width="100"
                Margin="8,0,0,0" />
        </StackPanel>

        <StackPanel
            HorizontalAlignment="Right"
            Classes="Margin8"
            DockPanel.Dock="Bottom"
            Orientation="Horizontal">
            <StackPanel
                Width="600"
                HorizontalAlignment="Left"
                VerticalAlignment="Center">
                <TextBlock Text="{x:Static resx:ResUI.TbRoutingTips}" />
            </StackPanel>
            <Button
                x:Name="btnSave"
                Width="100"
                Content="{x:Static resx:ResUI.TbConfirm}"
                Cursor="Hand"
                IsDefault="True" />
            <Button
                x:Name="btnCancel"
                Width="100"
                Margin="8,0"
                Content="{x:Static resx:ResUI.TbCancel}"
                Cursor="Hand"
                IsCancel="True" />
        </StackPanel>

        <DockPanel>
            <TabControl x:Name="tabAdvanced">
                <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRoutingTabRuleList}">
                    <DataGrid
                        x:Name="lstRoutings"
                        AutoGenerateColumns="False"
                        BorderThickness="1"
                        CanUserResizeColumns="True"
                        GridLinesVisibility="All"
                        HeadersVisibility="Column"
                        IsReadOnly="True"
                        ItemsSource="{Binding RoutingItems}">
                        <DataGrid.KeyBindings>
                            <KeyBinding Command="{Binding RoutingAdvancedSetDefaultCmd}" Gesture="Enter" />
                        </DataGrid.KeyBindings>
                        <DataGrid.ContextMenu>
                            <ContextMenu>
                                <MenuItem x:Name="menuRoutingAdvancedAdd" Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
                                <MenuItem x:Name="menuRoutingAdvancedRemove" Header="{x:Static resx:ResUI.menuRoutingAdvancedRemove}" />
                                <MenuItem x:Name="menuRoutingAdvancedSelectAll" Header="{x:Static resx:ResUI.menuSelectAll}" />
                                <MenuItem x:Name="menuRoutingAdvancedSetDefault" Header="{x:Static resx:ResUI.menuRoutingAdvancedSetDefault}" />
                                <Separator />
                                <MenuItem x:Name="menuRoutingAdvancedImportRules" Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
                            </ContextMenu>
                        </DataGrid.ContextMenu>

                        <DataGrid.Columns>
                            <DataGridCheckBoxColumn Width="40" Binding="{Binding IsActive}" />
                            <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>
    </DockPanel>
</Window>