ButtonTextBox - Style StaticResource Reference

Feb 5, 2015 at 1:49 PM
Edited Feb 5, 2015 at 1:50 PM
I am trying to use the ButtonTextBox control with the SearchButtonTextBoxStyle but when I use the XAML below, I get the following error: The resource "SearchButtonTextBoxStyle" could not be resolved. How do I reference or obtain the resource file that has this style?
<extra:Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:extra="http://schemas.extra.com/ui"
        xmlns:metro="http://schemas.codeplex.com/elysium" 
        xmlns:params="http://schemas.codeplex.com/elysium/params" 
        x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="350" Width="525" 
        WindowStartupLocation="CenterScreen" 
        params:Design.Theme="Light">
    <Grid>

        <extra:ButtonTextBox Watermark="Enter some text" Width="250" Height="25" HorizontalAlignment="Left" Margin="10"
                             Style="{StaticResource SearchButtonTextBoxStyle}"  />    </Grid>
</extra:Window>
Feb 5, 2015 at 3:15 PM
Here is my solution:
<extra:Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:extra="http://schemas.extra.com/ui"
        xmlns:metro="http://schemas.codeplex.com/elysium" 
        xmlns:params="http://schemas.codeplex.com/elysium/params" 
        x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="350" Width="525" 
        WindowStartupLocation="CenterScreen" 
        params:Design.Theme="Light">
    <extra:Window.Resources>
        <Style x:Key="SearchButtonTextBoxStyle" BasedOn="{StaticResource ButtonTextBoxBaseStyle}" TargetType="{x:Type extra:ButtonTextBox}">
            <Setter Property="Content" Value="{StaticResource SearchGeometry}"/>
            <Setter Property="Watermark" Value="Search"/>
        </Style>
        <Geometry x:Key="SearchGeometry">F1M54.8672,51.2266L42.1145,36.0703C44.2473,33.3333 45.6692,29.9946 46.0469,26.2942 47.1016,15.8333 39.4948,6.49219 29.0313,5.43213 18.5729,4.37231 9.2395,11.9868 8.17188,22.4453 7.10938,32.9036 14.7291,42.2446 25.1875,43.3098 28.6692,43.6563 32.0416,43.0469 35.0051,41.6797L47.9244,57.0547C49.5416,58.9634 52.401,59.2134 54.3125,57.6094 56.2266,55.9973 56.4766,53.1348 54.8672,51.2266 M15.9219,23.1614C16.5547,16.9399 22.1094,12.4087 28.3333,13.0391 34.5573,13.6719 39.0781,19.2266 38.4453,25.4426 37.8098,31.6692 32.2708,36.1953 26.0416,35.5703 19.8203,34.9399 15.2891,29.3828 15.9219,23.1614</Geometry>
        <Style x:Key="ButtonTextBoxBaseStyle" BasedOn="{StaticResource {x:Type extra:ButtonTextBox}}" TargetType="{x:Type extra:ButtonTextBox}">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Path Data="{Binding}" 
                          Fill="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}}, Path=Foreground, Mode=OneWay}" 
                          Height="16"
                          Stretch="Uniform" 
                          Width="16"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </extra:Window.Resources>
    
    <Grid>
        <extra:ButtonTextBox Watermark="Enter some text" Width="250" Height="25" HorizontalAlignment="Left" Margin="10"
                             Style="{StaticResource SearchButtonTextBoxStyle}"  />
    </Grid>
</extra:Window>