<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
                    xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
                    xmlns:themes="clr-namespace:XamlTheme">

    <Style TargetType="avalonedit:SearchPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type avalonedit:SearchPanel}">
                    <mwt:SystemDropShadowChrome Color="#71000000" Margin="0,1,3,3" HorizontalAlignment="Right" VerticalAlignment="Top">
                        <Border Background="#E7E8EC" BorderBrush="LightGray" BorderThickness="0"  Cursor="Arrow">
                            <StackPanel Orientation="Horizontal" Margin="3" Height="24"> 
                                <ToggleButton Width="24" ToolTip="Match Case"
                                              RenderOptions.EdgeMode="Unspecified"
                                              IsChecked="{Binding MatchCase, RelativeSource={RelativeSource TemplatedParent}}" 
                                              Style="{DynamicResource {x:Static themes:ResourceKeys.NormalToggleButtonStyleKey}}">
                                    <Image Width="13" Height="13">
                                        <Image.Source>
                                            <DrawingImage>
                                                <DrawingImage.Drawing>
                                                    <DrawingGroup>
                                                        <DrawingGroup.Children>
                                                            <GeometryDrawing Brush="{x:Null}" Geometry="F1M15.8,5.97C15.66,5.55 15.44,5.19 15.15,4.88 14.85,4.58 14.48,4.35 14.05,4.2 13.66,4.07 13.2,4 12.69,4 12.44,4 12.18,4.02 11.91,4.06 11.67,4.1 11.43,4.15 11.21,4.2 10.98,4.26 10.77,4.33 10.57,4.4 10.35,4.49 10.17,4.58 10.04,4.66L9.58,4.95 9.58,7.53C9.4,7.75 9.26,8.01 9.16,8.29 9.16,8.29 9.16,8.3 9.15,8.31L6.38,0 3.61,0 0,10.83 0,12 3.22,12 3.88,10 6.11,10 6.77,12 10.38,12 10.24,11.58C10.4,11.67 10.57,11.75 10.75,11.81 11.09,11.93 11.47,12 11.89,12 12.16,12 12.42,11.97 12.67,11.91L12.67,12 16,12 16,7.23C16,6.76,15.93,6.34,15.8,5.97z" />
                                                            <DrawingGroup>
                                                                <DrawingGroup.Children>
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M3.66,7.5L5,3.5 6.33,7.5 3.66,7.5z M4.33,1L1,11 2.5,11 3.16,9 6.83,9 7.5,11 9,11 5.66,1 4.33,1z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M13.68,8.59C13.68,8.78 13.65,8.96 13.58,9.13 13.52,9.3 13.42,9.44 13.3,9.57 13.18,9.69 13.04,9.79 12.87,9.86 12.7,9.94 12.51,9.97 12.3,9.97 12.15,9.97 12.02,9.95 11.89,9.91 11.77,9.87 11.67,9.81 11.58,9.74 11.5,9.67 11.43,9.59 11.39,9.49 11.34,9.39 11.32,9.28 11.32,9.16 11.32,9.03 11.33,8.92 11.36,8.82 11.39,8.72 11.45,8.63 11.53,8.55 11.61,8.47 11.72,8.41 11.85,8.35 12,8.3 12.18,8.26 12.4,8.24L13.68,8.07 13.68,8.59z M14.85,6.29C14.76,6.01 14.62,5.78 14.43,5.59 14.25,5.39 14.01,5.25 13.72,5.15 13.43,5.05 13.09,5 12.69,5 12.49,5 12.28,5.01 12.07,5.05 11.86,5.08 11.65,5.12 11.46,5.17 11.27,5.22 11.09,5.28 10.94,5.34 10.78,5.4 10.66,5.45 10.58,5.5L10.58,6.64C10.85,6.45 11.15,6.3 11.5,6.18 11.84,6.06 12.19,6.01 12.55,6.01 12.91,6.01 13.19,6.1 13.39,6.28 13.58,6.47 13.68,6.77 13.68,7.17L11.94,7.4C11.6,7.44 11.3,7.52 11.06,7.63 10.81,7.74 10.61,7.88 10.45,8.04 10.29,8.21 10.18,8.4 10.1,8.61 10.03,8.82 10,9.05 10,9.3 10,9.55 10.04,9.78 10.12,9.98 10.2,10.19 10.33,10.37 10.48,10.52 10.64,10.67 10.84,10.79 11.08,10.87 11.31,10.95 11.58,11 11.89,11 12.27,11 12.61,10.92 12.91,10.76 13.2,10.6 13.45,10.37 13.65,10.07L13.67,10.07 13.67,11 15,11 15,7.23C15,6.88,14.95,6.56,14.85,6.29z" />
                                                                </DrawingGroup.Children>
                                                            </DrawingGroup>
                                                        </DrawingGroup.Children>
                                                    </DrawingGroup>
                                                </DrawingImage.Drawing>
                                            </DrawingImage>
                                        </Image.Source>
                                    </Image>
                                </ToggleButton>
                                <ToggleButton Width="24" Margin="1,0" ToolTip="Match Whole Word"
                                              RenderOptions.EdgeMode="Unspecified"
                                              IsChecked="{Binding WholeWords, RelativeSource={RelativeSource TemplatedParent}}" 
                                              Style="{DynamicResource {x:Static themes:ResourceKeys.NormalToggleButtonStyleKey}}">
                                    <Image Width="13" Height="13">
                                        <Image.Source>
                                            <DrawingImage>
                                                <DrawingImage.Drawing>
                                                    <DrawingGroup>
                                                        <DrawingGroup.Children>
                                                            <GeometryDrawing Brush="{x:Null}" Geometry="F1M12.03,5L10,5 10,3 12.04,3 12.03,5z M7,6.83L5.72,3 7,3 7,6.83z M3.05,10L3.38,9 4.61,9 4.94,10 3.05,10z M15,0.01L0,0 0,3 2.28,3 0,9.83 0,11 0,12 0,13 15,12.98 15,0.01z" />
                                                            <DrawingGroup>
                                                                <DrawingGroup.Children>
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M11,7L11,9 9,9 9,7 11,7z M8,3L8,10 12,10 12,6 9,6 9,3 8,3z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M13,10L14,10 14,3 13.04,3 13,10z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M4,4L5,7 3,7 4,4z M5.33,8L6,10 7,10 4.66,3 3.33,3 1,10 2,10 2.66,8 5.33,8z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M1,1L1,2 14,2 14,1 1,1z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M1,12L14,12 14,11 1,11 1,12z" />
                                                                </DrawingGroup.Children>
                                                            </DrawingGroup>
                                                        </DrawingGroup.Children>
                                                    </DrawingGroup>
                                                </DrawingImage.Drawing>
                                            </DrawingImage>
                                        </Image.Source>
                                    </Image>
                                </ToggleButton>
                                <ToggleButton Width="24" ToolTip="Use Regular Expressions"
                                              RenderOptions.EdgeMode="Unspecified"
                                              IsChecked="{Binding UseRegex, RelativeSource={RelativeSource TemplatedParent}}" 
                                              Style="{DynamicResource {x:Static themes:ResourceKeys.NormalToggleButtonStyleKey}}">
                                    <Image Width="13" Height="13">
                                        <Image.Source>
                                            <DrawingImage>
                                                <DrawingImage.Drawing>
                                                    <DrawingGroup>
                                                        <DrawingGroup.Children>
                                                            <GeometryDrawing Brush="{x:Null}" Geometry="F1M14.34,5.7L12.94,1.79 10.81,2.68 11.09,0 6.9,0 7.18,2.68 5.05,1.79 3.65,5.7 6.06,6.11 5.33,6.99 0,6.99 0,12.99 6,12.99 6,9.22 7.78,10.45 9,8.22 10.24,10.45 13.58,8.11 11.95,6.11 14.34,5.7z" />
                                                            <DrawingGroup>
                                                                <DrawingGroup.Children>
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M13,4.91L12.35,3.11 9.64,4.25 9.98,1 8.01,1 8.35,4.25 5.64,3.11 5,4.91 7.93,5.41 5.86,7.91 7.44,9 8.99,6.16 10.58,9 12.13,7.91 10.09,5.41 13,4.91z" />
                                                                    <GeometryDrawing Brush="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}" Geometry="F1M1,11.99L5,11.99 5,7.99 1,7.99 1,11.99z" />
                                                                </DrawingGroup.Children>
                                                            </DrawingGroup>
                                                        </DrawingGroup.Children>
                                                    </DrawingGroup>
                                                </DrawingImage.Drawing>
                                            </DrawingImage>
                                        </Image.Source>
                                    </Image>
                                </ToggleButton>
                                <TextBox Name="PART_searchTextBox" Focusable="True" Width="200" BorderThickness="0" Margin="3,0" 
                                         VerticalContentAlignment="Center" Background="White"
                                         Style="{DynamicResource {x:Static themes:ResourceKeys.NormalTextBoxStyleKey}}">
                                    <TextBox.Text>
                                        <Binding Path="SearchPattern" RelativeSource="{RelativeSource TemplatedParent}" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <ExceptionValidationRule />
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <Button Width="24" ToolTip="Find Previous"
                                        Command="avalonedit:SearchCommands.FindPrevious" 
                                        Style="{DynamicResource {x:Static themes:ResourceKeys.ToolbarButtonStyleKey}}">
                                    <Path Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Button}}" Data="M0,3 H1V2 H2V1 H3V0 H6V1 H5V2 H4V3 H11V5 H4V6 H5V7 H6V8 H3V7 H2V6 H1V5 H0Z"/>
                                </Button>
                                <Button Width="24" ToolTip="Find Next"
                                        Command="avalonedit:SearchCommands.FindNext" 
                                        Style="{DynamicResource {x:Static themes:ResourceKeys.ToolbarButtonStyleKey}}">
                                    <Path Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Button}}" Data="M0,3 H1V2 H2V1 H3V0 H6V1 H5V2 H4V3 H11V5 H4V6 H5V7 H6V8 H3V7 H2V6 H1V5 H0Z">
                                        <Path.LayoutTransform>
                                            <ScaleTransform ScaleX="-1"/>
                                        </Path.LayoutTransform>
                                    </Path>
                                </Button>
                                <Separator Style="{DynamicResource {x:Static themes:ResourceKeys.VerSeparatorStyleKey}}" Margin="3"/>
                                <Button Width="24" Focusable="False" ToolTip="Close"
                                        Command="avalonedit:SearchCommands.CloseSearchPanel" 
                                        Style="{DynamicResource {x:Static themes:ResourceKeys.ToolbarButtonStyleKey}}">
                                    <Path Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Button}}" Data="F1M0,0L2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0z" />
                                </Button>
                            </StackPanel>
                        </Border>
                    </mwt:SystemDropShadowChrome>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>