<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
    xmlns:fv="clr-namespace:C1.WPF.FlexViewer"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type fv:SearchToolbar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type fv:SearchToolbar}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <c1:C1BrushBuilder
                            x:Name="BackgroundBrush"
                            Input="{StaticResource NormalBackground}"
                            DesignBrush="{StaticResource ToolbarBackgroundBrush}"
                            DesignColor="{StaticResource BaseDesignColor}"
                            />
                        
                        <c1:C1BrushBuilder
                            x:Name="SeparatorBrush"
                            Input="{StaticResource NormalBackground}"
                            DesignBrush="{StaticResource SeparatorDesignBrush}"
                            DesignColor="{StaticResource BaseDesignColor}"
                            />

                        <Border
                            x:Name="BackgroundElement"
                            Grid.ColumnSpan="2"
                            Background="{Binding Output, ElementName=BackgroundBrush}"
                            BorderBrush="{StaticResource BorderBrush}"
                            BorderThickness="0 0 0 1"
                            />

                        <StackPanel Orientation="Horizontal" Margin="0 1">

                            <Button
                                x:Name="closeSearchButton"
                                ToolTipService.ToolTip="{Binding CloseSearchTooltip, Source={StaticResource Strings}}"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                Width="{StaticResource ButtonWidth}"
                                >
                                <Viewbox RenderTransformOrigin="0.5,0.5" Margin="0" Stretch="Fill">
                                    <Viewbox.RenderTransform>
                                        <ScaleTransform ScaleX="0.8" ScaleY="0.8" /> <!-- adjust scale x/y to make 'x' bigger -->
                                    </Viewbox.RenderTransform>
                                    <Canvas Width="40" Height="40">
                                        <Line Stroke="{StaticResource IconBrush2}" StrokeThickness="4" X1="11.162" Y1="28.839" X2="28.84" Y2="11.161"/>
                                        <Line Stroke="{StaticResource IconBrush2}" StrokeThickness="4" X1="28.84" Y1="28.839" X2="11.162" Y2="11.161"/>
                                    </Canvas>
                                </Viewbox>
                            </Button>

                            <TextBlock
                                Text="{Binding FindLabel, Source={StaticResource Strings}}"
                                FontSize="{StaticResource FontSize}"
                                VerticalAlignment="Center"
                                Margin="3,0,5,0"
                                />
                            <c1:C1TextBoxBase
                                x:Name="searchTextBox"
                                ToolTipService.ToolTip="{Binding SearchTextTooltip, Source={StaticResource Strings}}"
                                VerticalAlignment="Center"
                                FontSize="{StaticResource FontSize}"
                                Height="{StaticResource TextBoxHeight}"
                                Width="120"
                                Margin="2 2"
                                Padding="2 1"
                                BorderBrush="{StaticResource BorderBrush}"
                                />
                            <Button
                                x:Name="searchPreviousButton"
                                ToolTipService.ToolTip="{Binding FindPreviousTooltip, Source={StaticResource Strings}}"
                                ToolTipService.ShowOnDisabled="True"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                Width="{StaticResource ButtonWidth}"
                                IsEnabled="False"
                                >
                                <Viewbox RenderTransformOrigin="0.5,0.5" Margin="0" Stretch="Fill">
                                    <Viewbox.RenderTransform>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </Viewbox.RenderTransform>
                                    <Canvas Width="100" Height="100">
                                        <Path Fill="{StaticResource IconBrush2}" >
                                            <Path.Data>
                                                M24.502,55.217C23.376,56.344 23.376,58.168 24.502,59.295 25.629,60.422 27.454,60.422 28.581,59.295L50.001,37.878 71.416,59.295C72.543,60.422 74.368,60.422 75.495,59.295 76.058,58.733 76.341,57.994 76.341,57.256 76.341,56.518 76.059,55.779 75.495,55.217L52.041,31.76C50.914,30.633,49.089,30.633,47.962,31.76L24.502,55.217z
                                            </Path.Data>
                                        </Path>
                                    </Canvas>
                                </Viewbox>
                            </Button>
                            <Button
                                x:Name="searchNextButton"
                                ToolTipService.ToolTip="{Binding FindNextTooltip, Source={StaticResource Strings}}"
                                ToolTipService.ShowOnDisabled="True"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                Width="{StaticResource ButtonWidth}"
                                IsEnabled="False"
                                >
                                <Viewbox RenderTransformOrigin="0.5,0.5" Margin="0" Stretch="Fill">
                                    <Viewbox.RenderTransform>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </Viewbox.RenderTransform>
                                    <Canvas Width="100" Height="100">
                                        <Path Fill="{StaticResource IconBrush2}" >
                                            <Path.Data>
                                                M75.493,44.782C76.62,43.655 76.62,41.83 75.493,40.703 74.366,39.577 72.541,39.577 71.414,40.703L50,62.121 28.58,40.703C27.454,39.577 25.628,39.577 24.501,40.703 23.938,41.266 23.656,42.005 23.656,42.743 23.656,43.481 23.938,44.219 24.501,44.783L47.96,68.238C49.087,69.365,50.913,69.365,52.039,68.238L75.493,44.782z
                                            </Path.Data>
                                        </Path>
                                    </Canvas>
                                </Viewbox>
                            </Button>

                            <Border 
                                Width="2" 
                                Background="{Binding Output, ElementName=SeparatorBrush}" 
                                BorderThickness="0,0,1,1" 
                                BorderBrush="#B2FFFFFF" 
                                Height="{StaticResource ButtonHeight}"
                                Margin="4,0" 
                                />

                            <ToggleButton
                                x:Name="matchCaseButton"
                                ToolTipService.ToolTip="{Binding MatchCaseTooltip, Source={StaticResource Strings}}"
                                ToolTipService.ShowOnDisabled="True"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                >
                                <TextBlock
                                    Text="{Binding MatchCaseLabel, Source={StaticResource Strings}}"
                                    Margin="4, 0"
                                    FontSize="{StaticResource FontSize}"
                                    />
                            </ToggleButton>

                            <ToggleButton
                                x:Name="wholeWordsButton"
                                ToolTipService.ToolTip="{Binding WholeWordsTooltip, Source={StaticResource Strings}}"
                                ToolTipService.ShowOnDisabled="True"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                Margin="2 0 0 0"
                                >
                                <TextBlock
                                    Text="{Binding WholeWordsLabel, Source={StaticResource Strings}}"
                                    Margin="4, 0"
                                    FontSize="{StaticResource FontSize}"
                                    />
                            </ToggleButton>

                            <ToggleButton
                                x:Name="searchOnCurrentPageButton"
                                ToolTipService.ToolTip="{Binding SearchOnCurrentPageTooltip, Source={StaticResource Strings}}"
                                ToolTipService.ShowOnDisabled="True"
                                Background="Transparent"
                                Style="{StaticResource ToolbarButtonStyle}"
                                Margin="2 0 0 0"
                                >
                                <TextBlock
                                    Text="{Binding SearchOnCurrentPageLabel, Source={StaticResource Strings}}"
                                    Margin="4, 0"
                                    FontSize="{StaticResource FontSize}"
                                    />
                            </ToggleButton>
                        </StackPanel>

                        <TextBlock
                            x:Name="searchingLabel"
                            Grid.Column="1"
                            Text="{Binding Searching, Source={StaticResource Strings}}"
                            FontSize="{StaticResource FontSize}"
                            TextWrapping="NoWrap"
                            VerticalAlignment="Center"
                            Margin="8 0"
                            />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>