<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      
        xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"       
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"        
        mc:Ignorable="d"
        x:Class="XMLScrubber.MainWindow" WindowStartupLocation="CenterScreen"      
        WindowStyle="None" Background="Transparent" ShowInTaskbar="True" AllowsTransparency="True" Height="850" Width="1200" ResizeMode="CanResizeWithGrip" Drop="Window_Drop" AllowDrop="true">
    <Window.Resources>
        <Style TargetType="TreeViewItem">
            <Setter Property="IsExpanded" Value="False" />
        </Style>
    </Window.Resources>
    <Border Background="#252525" CornerRadius="15,15,0,15" Padding="10" >
        <Border.Effect>
            <DropShadowEffect Color="Black" Direction="270" BlurRadius="5" Opacity=".5" ShadowDepth="3" />
        </Border.Effect>
        <DockPanel>
            <DockPanel DockPanel.Dock="Top" HorizontalAlignment="Right" Height="25" Width="1180">
                <Label Content="XML Scrubber" Foreground="ForestGreen" FontStyle="Normal" FontSize="24" Grid.Column="0" HorizontalAlignment="Left" Margin="550,-14,0,0" Height="45" VerticalAlignment="Top"  />
                <Button x:Name="Minimize" Content="_" Click="Minimize_Click" Width="25" ToolTip="Minimize Window" Margin="380,0,0,0" />
                <Button x:Name="Maximize" Content="F" Click="Maximize_Click" Width="25" ToolTip="Maximize Window" Margin="1,0,0,0"/>
                <Button x:Name="Restore" Content="R" Click="Restore_Click" Width="25" ToolTip="Restore Down Window"  Margin="-25,0,0,0"/>
                <Button Content="X" Click="Close_Click" Width="25" ToolTip="Close Window" Margin="-13,0,0,0" />
            </DockPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="350" MaxWidth="350"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Border BorderBrush="#FF548E19" BorderThickness="1" Height="295" Width="330" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="4,0,0,0"/>
                <DockPanel Grid.Column="0" Margin="4,-47,0,0" Height="294" VerticalAlignment="Top" HorizontalAlignment="Left" Width="330">
                    <TabControl x:Name="tabMain" Margin="0,49,0,-48.077" HorizontalAlignment="Left" Width="330" >
                        <TabItem Header="Find" x:Name="Find" Margin="27.717,0,-27.717,0">
                            <Grid Margin="0,0,-6,0" Height="275" VerticalAlignment="Top">
                                <Label Content="Text to Find:" HorizontalAlignment="Left" Height="30.04" Margin="20,-8.514,0,0" VerticalAlignment="Top" Width="127"/>
                                <TextBox x:Name="txtFind" Height="24" Margin="23,17.526,27,0" TextWrapping="NoWrap" VerticalAlignment="Top"/>
                                <Button Content="Clear" Click="Clear_Click" Height="24" Margin="119,75.527,131,0" VerticalAlignment="Top"/>
                                <Button Content="Find Next" Click="FindNextClick" IsDefault="True" IsEnabled="{Binding ElementName=txtFind, Path=Text.Length, Mode=OneWay}" HorizontalAlignment="Right" Height="24" Margin="0,75.527,27,0" VerticalAlignment="Top" Width="80">
                                </Button>
                                <CheckBox x:Name="cbCaseSensitive" Content="Match case" Checked="cbCaseSensitive_Checked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,122.473" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Match case" HorizontalAlignment="Left" Margin="39,131.527,0,120.473" Width="108"/>
                                <CheckBox Content="Regular Expression" x:Name="cbRegex" Checked="cbRegex_Checked" IsChecked="false" Height="15" Margin="0,0,147,122.473" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Regular Expression" Height="27" Margin="0,131.527,27,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120"/>
                                <CheckBox Content="Match whole word" x:Name="cbWholeWord" Checked="cbWholeWord_Checked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,95.473" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Match whole word" HorizontalAlignment="Left" Height="23" Margin="39,158.527,0,0" VerticalAlignment="Top" Width="108"/>
                                <CheckBox Content="Wildcards" x:Name="cbWildcards" Checked="cbWildcards_Checked" IsChecked="false" Height="15" Margin="0,0,147,95.473" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Wildcards" Height="23" Margin="0,158.527,39,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="108"/>
                                <CheckBox Content="Collapse" x:Name="cbCollapse" Checked="cbCollapse_Checked" Unchecked="cbCollapse_UnChecked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,70.473" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Collapse" HorizontalAlignment="Left" Height="26" Margin="39,183.527,0,0" VerticalAlignment="Top" Width="108"/>
                                <CheckBox Content="Search up" x:Name="cbSearchUp" Checked="cbSearchUp_Checked" IsChecked="false" Height="15" Margin="0,0,147,70.473" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Search up" Height="26.96" Margin="0,183.527,39,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="108"/>
                            </Grid>
                        </TabItem>
                        <TabItem Header="Replace" x:Name="Replace" Margin="0,0,-27.717,0" HorizontalAlignment="Right" Width="103.877">
                            <Grid Margin="0,0,-6,2.04">
                                <Label Content="Text to Find:" HorizontalAlignment="Left" Height="30.04" Margin="20,-10.076,0,0" VerticalAlignment="Top" Width="127"/>
                                <TextBox x:Name="txtFind2" Text="{Binding txtFind2}" Height="24" Margin="23,15.924,27,0" TextWrapping="NoWrap" VerticalAlignment="Top"/>
                                <Button Content="Replace" IsEnabled="{Binding ElementName=txtReplace, Path=Text.Length, Mode=OneWay}" Margin="125,108,125,109" Click="ReplaceClick">
                                </Button>
                                <Button Content="Replace All" IsEnabled="{Binding ElementName=txtReplace, Path=Text.Length, Mode=OneWay}" HorizontalAlignment="Right" Margin="0,108,26,109" Width="80" Click="ReplaceAllClick">
                                </Button>
                                <Button Content="Find Next" IsDefault="True" IsEnabled="{Binding ElementName=txtFind2, Path=Text.Length, Mode=OneWay}" Margin="24,108,0,109" HorizontalAlignment="Left" Width="80" Click="FindNextClick">
                                </Button>
                                <Label Content="Replace with:" HorizontalAlignment="Left" Height="30.04" Margin="20,45.924,0,0" VerticalAlignment="Top" Width="127"/>
                                <TextBox x:Name="txtReplace" Height="24" Margin="23,73.526,27,0" TextWrapping="NoWrap" VerticalAlignment="Top"/>
                                <CheckBox x:Name="cbCaseSensitive_Copy" Content="Match case" Checked="cbCaseSensitive_Checked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,81.038" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Match case" HorizontalAlignment="Left" Height="23" Margin="39,0,0,79.038" VerticalAlignment="Bottom" Width="108"/>
                                <CheckBox Content="Regular Expression" x:Name="cbRegex_Copy" Checked="cbRegex_Checked" IsChecked="false" Height="15" Margin="0,0,147,81.038" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Regular Expression" Height="27" Margin="0,143.527,27,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120"/>
                                <CheckBox Content="Match whole word" x:Name="cbWholeWord_Copy" Checked="cbWholeWord_Checked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,54.038" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Match whole word" HorizontalAlignment="Left" Height="23" Margin="39,170.527,0,0" VerticalAlignment="Top" Width="108"/>
                                <CheckBox Content="Wildcards" x:Name="cbWildcards_Copy" Checked="cbWildcards_Checked" IsChecked="false" Height="15" Margin="0,0,147,54.038" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Wildcards" Height="23" Margin="0,170.527,39,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="108"/>
                                <CheckBox Content="Collapse" x:Name="cbCollapse_Copy" Checked="cbCollapse_Checked" Unchecked="cbCollapse_UnChecked" IsChecked="false" HorizontalAlignment="Left" Height="15" Margin="23,0,0,29.038" VerticalAlignment="Bottom" Width="16"/>
                                <Label Content="Collapse" HorizontalAlignment="Left" Height="26" Margin="39,195.527,0,0" VerticalAlignment="Top" Width="108"/>
                                <CheckBox Content="Search up" x:Name="cbSearchUp_Copy" Checked="cbSearchUp_Checked" IsChecked="false" Height="15" Margin="0,0,147,29.038" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="16"/>
                                <Label Content="Search up" Height="26.96" Margin="0,195.527,39,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="108"/>
                            </Grid>
                        </TabItem>
                        <TabItem Header="Evaluate" x:Name="Evaluate" Margin="27.717,0,-27.717,0">
                            <Grid Margin="0,0,-6,0">
                                <Label Content="Evaluate XPath:" HorizontalAlignment="Left" Height="30.04" Margin="20,-7.999,0,0" VerticalAlignment="Top" Width="127"/>
                                <TextBox x:Name="txtEval" Height="24" Margin="23,18.001,27,0" TextWrapping="NoWrap" VerticalAlignment="Top"/>
                                <Button Content="Clear" Click="Clear_Click" Height="24" Margin="119,115.527,131,0" VerticalAlignment="Top"/>
                                <Button Content="Evaluate" IsDefault="True" IsEnabled="{Binding ElementName=txtEval, Path=Text.Length, Mode=OneWay}" HorizontalAlignment="Right" Margin="0,115.527,27,102" Width="80" Click="Eval_Click">
                                </Button>
                                <Label Content="Value:" HorizontalAlignment="Left" Height="30.04" Margin="20,48.001,0,0" VerticalAlignment="Top" Width="127"/>
                                <TextBox x:Name="txtValue" Height="24" Margin="23,73.526,27,0" TextWrapping="NoWrap" VerticalAlignment="Top"/>
                            </Grid>
                        </TabItem>
                    </TabControl>
                </DockPanel>
                <avalonEdit:TextEditor x:Name="xmlin" BorderBrush="#FF548E19" BorderThickness="2" MouseHover="xmlin_MouseHover" MouseHoverStopped="xmlin_MouseHoverStopped" Grid.Column="1" Margin="0,0,2.25,2.5"/>
                <GridSplitter Background="#FF548E19" ToolTip="Slider" Width="4" Margin="0,0,0,2.5"/>
                <Grid Name="expanderGrid" Margin="0,300,0,0" Height="415" VerticalAlignment="Top" HorizontalAlignment="Left" Width="340">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.5*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="0.5*"/>
                    </Grid.RowDefinitions>
                    <Expander Name="topExpander" Header="XPath:" IsExpanded="True" Margin="5,5,7,5">
                        <TextBox x:Name="txtmessage" IsReadOnly="True" TextWrapping="Wrap" BorderThickness="0" BorderBrush="#FF548E19" AcceptsReturn="True" />
                    </Expander>
                    <GridSplitter Name="splitter" ResizeDirection="Rows" HorizontalAlignment="Stretch" Grid.Row="2" Height="0" Margin="0,100.25,2,100.25"/>
                    <Expander Name="bottomExpander" Header="XML Tree:" Grid.Row="2" IsExpanded="True" Margin="5,5,7,5">
                        <TreeView x:Name="tvxpath" SelectedItemChanged="tvxpath_SelectedItemChanged" BorderThickness="0" BorderBrush="#FF548E19" />
                    </Expander>
                </Grid>
                <Border BorderBrush="#FF548E19" BorderThickness="1" Height="75" Margin="4,722.5,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="330"/>
                <Button Height="32" Width="32" Margin="12.5,731.654,0,0" Click="btnExplorer_Click" Cursor="Hand" ToolTip="Browse Or Drag XML File" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Button.Template>
                        <ControlTemplate>
                            <Image Source="/images/fileexplorer.png"/>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
                <TextBox x:Name="txtXMLPath" IsReadOnly="True" Height="24" Margin="48.5,737.654,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="201.5"/>
                <Button Height="32" Width="32" Margin="254,734.404,0,0" Click="btnReload_Click" Cursor="Hand" ToolTip="Reload XML File" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Button.Template>
                        <ControlTemplate>
                            <Image Source="/images/reload.png"/>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
                <Button Height="32" Width="32" Margin="290,734.404,0,0" Click="btnSave_Click" Cursor="Hand" ToolTip="Save File" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Button.Template>
                        <ControlTemplate>
                            <Image Source="/images/save.png"/>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
                <Grid Margin="12.5,770.404,26,0" Height="17.846" VerticalAlignment="Top">
                    <ProgressBar x:Name="progressBar" Height="Auto" ValueChanged="progressBar_ValueChanged" Margin="8,1.96,9.5,1.886"/>
                    <TextBlock Text="{Binding ElementName=progressBar, Path=Value, StringFormat={}{0:0}%}" VerticalAlignment="Top" Margin="143.105,0,136.355,0" />
                </Grid>
            </Grid>
        </DockPanel>
    </Border>
</Window>
