<styles:WindowChromeBase x:Class="_1RM.View.MainWindowView"
                         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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         xmlns:attachProperty="clr-namespace:Shawn.Utils.WpfResources.Theme.AttachProperty;assembly=Shawn.Utils.WpfResources"
                         xmlns:s="https://github.com/canton7/Stylet"
                         xmlns:view="clr-namespace:_1RM.View"
                         xmlns:styles="clr-namespace:Shawn.Utils.WpfResources.Theme.Styles;assembly=Shawn.Utils.WpfResources"
                         xmlns:service="clr-namespace:_1RM.Service"
                         xmlns:Rm="clr-namespace:_1RM"
                         xmlns:locality="clr-namespace:_1RM.Service.Locality"
                         mc:Ignorable="d"
                         BorderThickness="0"
                         BorderBrush="Transparent"
                         Background="{DynamicResource BackgroundBrush}"
                         KeyDown="MainWindow_OnKeyDown"
                         d:DataContext="{d:DesignInstance view:MainWindowViewModel}"
                         Style="{StaticResource WindowChromeBaseBaseStyle}"
                         Title="{x:Static Rm:Assert.APP_NAME}" 
                         Height="560" Width="900" 
                         MinWidth="300" MinHeight="300">
    <styles:WindowChromeBase.Resources>
        <ResourceDictionary>
            <RoutedUICommand x:Key="CommandFocusFilter" Text="Focus on filter" />
        </ResourceDictionary>
    </styles:WindowChromeBase.Resources>
    <styles:WindowChromeBase.CommandBindings>
        <CommandBinding Command="{StaticResource CommandFocusFilter}" Executed="CommandFocusFilter_OnExecuted"></CommandBinding>
    </styles:WindowChromeBase.CommandBindings>
    <styles:WindowChromeBase.InputBindings>
        <!-- map ctrl + f to focus on filter-->
        <KeyBinding Gesture="Ctrl+F" Command="{StaticResource CommandFocusFilter}"></KeyBinding>
    </styles:WindowChromeBase.InputBindings>

    <Grid Background="{DynamicResource PrimaryMidBrush}">
        <Grid>
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Effect">
                        <Setter.Value>
                            <BlurEffect Radius="2" KernelType="Box"></BlurEffect>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=TopLevelViewModel, Mode=OneWay}" Value="{x:Null}">
                            <Setter Property="Effect" Value="{x:Null}"></Setter>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.RowDefinitions>
                <RowDefinition Height="40"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid Background="Transparent" Name="WinTitleBar">
                <StackPanel Orientation="Horizontal">
                    <Grid Background="Transparent" Width="24" Height="24" Margin="5">
                        <Image Source="/Resources/Image/Logo/logo32.png"></Image>
                    </Grid>
                    <TextBlock VerticalAlignment="Center" 
                               Style="{StaticResource TextBlockBase}"
                               Foreground="{DynamicResource PrimaryTextBrush}" Text="{Binding Title, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
                </StackPanel>
            </Grid>

            <!-- System Button Area -->
            <StackPanel Grid.Row="0"
                        Orientation="Horizontal" HorizontalAlignment="Right">
                <Grid Height="35" VerticalAlignment="Top" Margin="0 0 4 0">
                    <TextBox Width="150" Height="25" FontSize="12"
                             attachProperty:FocusExtension.IsFocused="{Binding MainFilterIsFocused}"
                             attachProperty:TextBoxAttachProperty.CaretIndex="{Binding MainFilterCaretIndex, UpdateSourceTrigger=PropertyChanged}"
                             Text="{Binding MainFilterString, UpdateSourceTrigger=PropertyChanged}"
                             Tag="{DynamicResource 'Search (Ctrl+F)'}"
                             KeyUp="MainFilter_OnKeyUp" 
                             VerticalAlignment="Center" HorizontalAlignment="Right" HorizontalContentAlignment="Left">
                        <TextBox.Style>
                            <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxAccentStyle}">
                                <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"></Setter>
                                <Setter Property="Background" Value="Transparent"></Setter>
                                <Setter Property="Opacity" Value="0.5"></Setter>
                                <Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"></Setter>
                                <Setter Property="IsEnabled" Value="False"></Setter>
                                <Setter Property="Visibility" Value="Collapsed"></Setter>
                                <Style.Triggers>
                                    <MultiDataTrigger>
                                        <MultiDataTrigger.Conditions>
                                            <Condition Binding="{Binding EditorViewModel}" Value="{x:Null}"></Condition>
                                            <Condition Binding="{Binding ShowSetting}" Value="False"></Condition>
                                        </MultiDataTrigger.Conditions>
                                        <MultiDataTrigger.EnterActions>
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetProperty="Opacity" AccelerationRatio="0.9" To="1" Duration="0:0:0.5"/>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </MultiDataTrigger.EnterActions>
                                        <MultiDataTrigger.ExitActions>
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetProperty="Opacity" AccelerationRatio="0.9" To="0" Duration="0:0:0.5"/>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Collapsed}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </MultiDataTrigger.ExitActions>
                                        <MultiDataTrigger.Setters>
                                            <Setter Property="IsEnabled" Value="True"></Setter>
                                        </MultiDataTrigger.Setters>
                                    </MultiDataTrigger>
                                    <DataTrigger Binding="{Binding ServerListViewModel.TagListViewModel}" Value="{x:Null}">
                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </Grid>

                <Grid Width="35" Height="35" Margin="0" VerticalAlignment="Top">
                    <CheckBox Name="CbPopForMenu" Width="35" Height="35" VerticalAlignment="Top" Margin="0">
                        <CheckBox.Template>
                            <ControlTemplate>
                                <Border Name="BG" Background="{DynamicResource PrimaryMidBrush}">
                                    <Grid VerticalAlignment="Center">
                                        <Grid Width="15" Height="15">
                                            <Path Data="F1 M 88.000000 -60.500000 L 0.000000 -60.500000 L 0.000000 -66.000000 L 88.000000 -66.000000 L 88.000000 -60.500000 Z M 88.000000 -16.500000 L 0.000000 -16.500000 L 0.000000                                         -22.000000 L 88.000000 -22.000000 L 88.000000 -16.500000 Z M 88.000000 -38.500000 L 0.000000 -38.500000 L 0.000000 -44.000000 L 88.000000 -44.000000 L 88.000000 -38.500000 Z "
                                              Fill="{DynamicResource PrimaryTextBrush}" Opacity="0.8" StrokeThickness="0.5" Stretch="Fill" />
                                        </Grid>
                                    </Grid>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="CheckBox.IsMouseOver" Value="True">
                                        <Setter TargetName="BG" Property="Background" Value="{DynamicResource PrimaryLightBrush}"></Setter>
                                    </Trigger>
                                    <Trigger Property="CheckBox.IsChecked" Value="True">
                                        <Setter TargetName="BG" Property="Background" Value="{DynamicResource PrimaryDarkBrush}"></Setter>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </CheckBox.Template>
                    </CheckBox>

                    <Grid Width="15" Height="15">
                        <Path Data="F1 M 10 3.4375 C 10.605469 3.4375 11.186523 3.515625 11.743164 3.671875 C 12.299805 3.828125 12.822266 4.049479 13.310547 4.335938 C 13.798828 4.622396 14.241536 4.964193 14.638672 5.361328 C 15.035807 5.758464 15.377604 6.201172 15.664063 6.689453 C 15.950521 7.177734 16.171875 7.700195 16.328125 8.256836 C 16.484375 8.813477 16.5625 9.394531 16.5625 10 C 16.5625 10.605469 16.484375 11.186523 16.328125 11.743164 C 16.171875 12.299805 15.950521 12.822266 15.664063 13.310547 C 15.377604 13.798828 15.035807 14.241537 14.638672 14.638672 C 14.241536 15.035808 13.798828 15.377604 13.310547 15.664063 C 12.822266 15.950521 12.299805 16.171875 11.743164 16.328125 C 11.186523 16.484375 10.605469 16.5625 10 16.5625 C 9.394531 16.5625 8.813477 16.484375 8.256836 16.328125 C 7.700195 16.171875 7.177734 15.950521 6.689453 15.664063 C 6.201172 15.377604 5.758463 15.035808 5.361328 14.638672 C 4.964192 14.241537 4.622396 13.798828 4.335938 13.310547 C 4.049479 12.822266 3.828125 12.299805 3.671875 11.743164 C 3.515625 11.186523 3.4375 10.605469 3.4375 10 C 3.4375 9.394531 3.515625 8.813477 3.671875 8.256836 C 3.828125 7.700195 4.049479 7.177734 4.335938 6.689453 C 4.622396 6.201172 4.964192 5.758464 5.361328 5.361328 C 5.758463 4.964193 6.201172 4.622396 6.689453 4.335938 C 7.177734 4.049479 7.700195 3.828125 8.256836 3.671875 C 8.813477 3.515625 9.394531 3.4375 10 3.4375 Z "
                              Fill="Red"
                              Stretch="Uniform"
                              Width="6"
                              Margin="0 -3 -3 0"
                              VerticalAlignment="Top" HorizontalAlignment="Right">
                            <Path.Style>
                                <Style TargetType="Path">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding AboutViewModel.NewVersion}" Value="">
                                            <Setter Property="Visibility" Value="Collapsed"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Path.Style>
                        </Path>
                    </Grid>
                </Grid>

                <Popup Name="PopupMenu"
                       AllowsTransparency="True"
                       IsOpen="{Binding ElementName=CbPopForMenu, Path=IsChecked}"
                       StaysOpen="False"
                       PlacementTarget="{Binding ElementName=CbPopForMenu}">
                    <Border CornerRadius="5" Background="{DynamicResource PrimaryDarkBrush}">
                        <StackPanel Orientation="Vertical" MinWidth="138">
                            <MenuItem Header="{DynamicResource Options}" Command="{Binding CmdGoSysOptionsPage}">
                                <MenuItem.Icon>
                                    <Path UseLayoutRounding="True" Data="{StaticResource GeometrySetting}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="{DynamicResource 'Toggle Cards/List'}" Command="{Binding CmdToggleCardList}"></MenuItem>
                            <MenuItem Header="{DynamicResource Sorting}" IsEnabled="{Binding IsShownList}">
                                <MenuItem.Resources>
                                    <Style TargetType="Path" x:Key="HeaderPathStyle">
                                        <Setter Property="Visibility" Value="Hidden" />
                                        <Setter Property="StrokeThickness" Value="1" />
                                        <Setter Property="Width" Value="20" />
                                        <Setter Property="HorizontalAlignment" Value="Center" />
                                        <Setter Property="Margin" Value="5,0,5,0" />
                                        <Setter Property="SnapsToDevicePixels" Value="True" />
                                    </Style>
                                </MenuItem.Resources>
                                <MenuItem Command="{Binding CmdReOrder}" CommandParameter="{x:Static locality:EnumServerOrderBy.IdAsc}">
                                    <MenuItem.Icon>
                                        <Path UseLayoutRounding="True" Data="{StaticResource GeometryHook}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.IdAsc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </MenuItem.Icon>
                                    <MenuItem.Header>
                                        <Grid>
                                            <TextBlock Margin="5" HorizontalAlignment="Left" Text="Id"></TextBlock>
                                        </Grid>
                                    </MenuItem.Header>
                                </MenuItem>



                                <MenuItem Command="{Binding CmdReOrder}" CommandParameter="{x:Static locality:EnumServerOrderBy.ProtocolAsc}">
                                    <MenuItem.Icon>
                                        <Path UseLayoutRounding="True" Data="{StaticResource GeometryHook}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.ProtocolAsc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.ProtocolDesc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </MenuItem.Icon>
                                    <MenuItem.Header>
                                        <Grid>
                                            <Path Data="M 7,3 L 13,3 L 10,0 L 7,3" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.ProtocolAsc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <Path Data="M 7,0 L 10,3 L 13,0 L 7,0" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.ProtocolDesc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <TextBlock Margin="5" HorizontalAlignment="Left" Text="{DynamicResource Protocol}"></TextBlock>
                                        </Grid>
                                    </MenuItem.Header>
                                </MenuItem>


                                <MenuItem Command="{Binding CmdReOrder}" CommandParameter="{x:Static locality:EnumServerOrderBy.NameAsc}">
                                    <MenuItem.Icon>
                                        <Path UseLayoutRounding="True" Data="{StaticResource GeometryHook}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.NameAsc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.NameDesc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </MenuItem.Icon>
                                    <MenuItem.Header>
                                        <Grid>
                                            <Path Data="M 7,3 L 13,3 L 10,0 L 7,3" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.NameAsc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <Path Data="M 7,0 L 10,3 L 13,0 L 7,0" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.NameDesc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <TextBlock Margin="5" HorizontalAlignment="Left" Text="{DynamicResource Name}"></TextBlock>
                                        </Grid>
                                    </MenuItem.Header>
                                </MenuItem>


                                <MenuItem Command="{Binding CmdReOrder}" CommandParameter="{x:Static locality:EnumServerOrderBy.AddressAsc}">
                                    <MenuItem.Icon>
                                        <Path UseLayoutRounding="True" Data="{StaticResource GeometryHook}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.AddressAsc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.AddressDesc}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </MenuItem.Icon>
                                    <MenuItem.Header>
                                        <Grid>
                                            <Path Data="M 7,3 L 13,3 L 10,0 L 7,3" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.AddressAsc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <Path Data="M 7,0 L 10,3 L 13,0 L 7,0" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem}, Path=Foreground}">
                                                <Path.Style>
                                                    <Style TargetType="Path" BasedOn="{StaticResource HeaderPathStyle}">
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.AddressDesc}">
                                                                <Setter Property="Visibility" Value="Visible"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Path.Style>
                                            </Path>
                                            <TextBlock Margin="5" HorizontalAlignment="Left" Text="{DynamicResource Hostname}"></TextBlock>
                                        </Grid>
                                    </MenuItem.Header>
                                </MenuItem>


                                <MenuItem Command="{Binding CmdReOrder}" CommandParameter="{x:Static locality:EnumServerOrderBy.Custom}">
                                    <MenuItem.Icon>
                                        <Path UseLayoutRounding="True" Data="{StaticResource GeometryHook}" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding ServerListViewModel.ServerOrderBy}" Value="{x:Static locality:EnumServerOrderBy.Custom}">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </MenuItem.Icon>
                                    <MenuItem.Header>
                                        <Grid>
                                            <TextBlock Margin="5" HorizontalAlignment="Left" Text="{DynamicResource 'Sort by drag'}"></TextBlock>
                                        </Grid>
                                    </MenuItem.Header>
                                </MenuItem>
                            </MenuItem>
                            <MenuItem Command="{Binding CmdGoAboutPage}">
                                <MenuItem.Icon>
                                    <Image Source="/Resources/Image/Logo/logo32.png" Width="20"></Image>
                                </MenuItem.Icon>
                                <MenuItem.Header>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{DynamicResource About}" VerticalAlignment="Center"></TextBlock>
                                        <Path Fill="Red" Margin="5 0"
                                              Data="F1 M 10 3.4375 C 10.605469 3.4375 11.186523 3.515625 11.743164 3.671875 C 12.299805 3.828125 12.822266 4.049479 13.310547 4.335938 C 13.798828 4.622396 14.241536 4.964193 14.638672 5.361328 C 15.035807 5.758464 15.377604 6.201172 15.664063 6.689453 C 15.950521 7.177734 16.171875 7.700195 16.328125 8.256836 C 16.484375 8.813477 16.5625 9.394531 16.5625 10 C 16.5625 10.605469 16.484375 11.186523 16.328125 11.743164 C 16.171875 12.299805 15.950521 12.822266 15.664063 13.310547 C 15.377604 13.798828 15.035807 14.241537 14.638672 14.638672 C 14.241536 15.035808 13.798828 15.377604 13.310547 15.664063 C 12.822266 15.950521 12.299805 16.171875 11.743164 16.328125 C 11.186523 16.484375 10.605469 16.5625 10 16.5625 C 9.394531 16.5625 8.813477 16.484375 8.256836 16.328125 C 7.700195 16.171875 7.177734 15.950521 6.689453 15.664063 C 6.201172 15.377604 5.758463 15.035808 5.361328 14.638672 C 4.964192 14.241537 4.622396 13.798828 4.335938 13.310547 C 4.049479 12.822266 3.828125 12.299805 3.671875 11.743164 C 3.515625 11.186523 3.4375 10.605469 3.4375 10 C 3.4375 9.394531 3.515625 8.813477 3.671875 8.256836 C 3.828125 7.700195 4.049479 7.177734 4.335938 6.689453 C 4.622396 6.201172 4.964192 5.758464 5.361328 5.361328 C 5.758463 4.964193 6.201172 4.622396 6.689453 4.335938 C 7.177734 4.049479 7.700195 3.828125 8.256836 3.671875 C 8.813477 3.515625 9.394531 3.4375 10 3.4375 Z "
                                              Stretch="Uniform"
                                              Width="6"
                                              VerticalAlignment="Center" HorizontalAlignment="Center">
                                            <Path.Style>
                                                <Style TargetType="Path">
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding AboutViewModel.NewVersion}" Value="">
                                                            <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Path.Style>
                                        </Path>
                                    </StackPanel>
                                </MenuItem.Header>
                            </MenuItem>
                            <Separator Style="{StaticResource SeparatorBaseStyle}"/>
                            <MenuItem Header="{DynamicResource Exit}" Command="{Binding CmdExit}"></MenuItem>
                        </StackPanel>
                    </Border>
                </Popup>

                <Button Name="BtnMinimize" Style="{StaticResource ButtonBarPrimaryStyle}"
                               Width="35" Height="35" VerticalAlignment="Top" BorderThickness="0">
                    <Rectangle Width="15" Height="1" Stroke="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" StrokeThickness="0.5" />
                </Button>

                <Button Name="BtnMaximize" Style="{StaticResource ButtonBarPrimaryStyle}" Width="35" Height="35" VerticalAlignment="Top">
                    <Grid>
                        <Path Height="15" Width="15"
                              StrokeThickness="0.5" 
                              Stroke="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}"
                              Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}"
                              Data="F1 M 5.500000 -82.500000 L 82.500000 -82.500000 L 82.500000 -5.500000 L 5.500000 -5.500000 Z M 77.000000 -11.000000 L 77.000000 -77.000000 L 11.000000 -77.000000 L 11.000000 -11.000000 Z "
                              Stretch="Uniform">
                            <Path.Style>
                                <Style TargetType="Path">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=WindowState}" Value="Maximized">
                                            <Setter Property="Visibility" Value="Hidden"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Path.Style>
                        </Path>

                        <Path Height="15" Width="15"
                              StrokeThickness="1" 
                              Stroke="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}"
                              Data="M2,2 L2,0 L8,0 L8,6 L6,6 M0,2 L6,2 L6,8 L0,8 Z"
                              Stretch="Uniform">
                            <Path.Style>
                                <Style TargetType="Path">
                                    <Setter Property="Visibility" Value="Hidden"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=WindowState}" Value="Maximized">
                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Path.Style>
                        </Path>
                    </Grid>
                </Button>

                <Button Name="BtnClose" Width="35" Height="35" VerticalAlignment="Top"
                    Style="{StaticResource ButtonBarPrimaryStyle}"
                    attachProperty:VisionElement.ForegroundAccent="White"
                    attachProperty:VisionElement.BackgroundAccent="Red"
                    attachProperty:VisionElement.ForegroundOnMouseDown="White"
                    attachProperty:VisionElement.BackgroundOnMouseDown="Red">
                    <Path Height="15" Width="15"
                          StrokeThickness="0.5" 
                          Stroke="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}"
                          Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}"
                          Data="F1 M 47.910156 -44.000000 L 87.183594 -4.683594 L 83.316406 -0.816406 L 44.000000 -40.089844 L 4.683594 -0.816406 L 0.816406 -4.683594 L 40.089844 -44.000000 L 0.816406 -83.316406 L 4.683594 -87.183594 L 44.000000 -47.910156 L 83.316406 -87.183594 L 87.183594 -83.316406 Z "
                          Stretch="Uniform">
                    </Path>
                </Button>
            </StackPanel>


            <!-- Paging Area -->
            <Grid Grid.Row="1">
                <Grid.Style>
                    <Style TargetType="Grid">
                        <Setter Property="Effect">
                            <Setter.Value>
                                <BlurEffect Radius="1" KernelType="Box"></BlurEffect>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=TopLevelViewModel, Mode=OneWay}" Value="{x:Null}">
                                <Setter Property="Effect" Value="{x:Null}"></Setter>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                <ContentControl s:View.Model="{Binding ServerListViewModel}"></ContentControl>
                <ContentControl s:View.Model="{Binding SettingViewModel}">
                    <ContentControl.Style>
                        <Style TargetType="ContentControl">
                            <Setter Property="Visibility" Value="Collapsed"></Setter>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ShowSetting}" Value="True">
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:0.1" Value="{x:Static Visibility.Visible}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ThicknessAnimation BeginTime="0:0:0.0" Storyboard.TargetProperty="Margin" From="1000 0 0 0" To="0" Duration="0:0:0.5"></ThicknessAnimation>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.EnterActions>
                                    <DataTrigger.ExitActions>
                                        <BeginStoryboard>
                                            <Storyboard >
                                                <ThicknessAnimation Storyboard.TargetProperty="Margin" From="0 0 0 0" To="1000 0 0 0" Duration="0:0:0.3"></ThicknessAnimation>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.ExitActions>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </ContentControl.Style>
                </ContentControl>
                <ContentControl s:View.Model="{Binding EditorViewModel}">
                    <ContentControl.Style>
                        <Style TargetType="ContentControl">
                            <Setter Property="Visibility" Value="Collapsed"></Setter>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding EditorViewModel}" Value="{x:Null}">
                                    <DataTrigger.ExitActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ThicknessAnimation Storyboard.TargetProperty="Margin" AccelerationRatio="0.9" From="1000 0 0 0" To="0" Duration="0:0:0.5"></ThicknessAnimation>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.ExitActions>
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.EnterActions>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </ContentControl.Style>
                </ContentControl>
            </Grid>
        </Grid>

        <Grid Background="Transparent">
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Visibility" Value="Visible"></Setter>
                    <Setter Property="Background" Value="Transparent"></Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=TopLevelViewModel, Mode=OneWay}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed"></Setter>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <ContentControl PreviewMouseDown="ProcessingRing_OnPreviewMouseDown"
                            PreviewMouseMove="WinTitleBar_OnPreviewMouseMove"
                            s:View.Model="{Binding TopLevelViewModel}"></ContentControl>
        </Grid>

    </Grid>
</styles:WindowChromeBase>