Create Search Box Control
<p>I'm trying to create a search text box where I have a Text Box area plus the button. So far I achieve my expected layout:</p>

<pre><code>&lt;Style TargetType="{x:Type local:SearchTextBox}"&gt;
        &lt;Setter Property="Template"&gt;
            &lt;Setter.Value&gt;
                &lt;ControlTemplate TargetType="{x:Type local:SearchTextBox}"&gt;
                    &lt;Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"&gt;
                        &lt;StackPanel Orientation="Horizontal"
                                          Width="200"&gt;
                            &lt;TextBox Width="150" TextWrapping="Wrap" AcceptsReturn="True"/&gt;
                            &lt;Button Width="50" Content="Browse"&gt;&lt;/Button&gt;
                        &lt;/StackPanel&gt;
                    &lt;/Border&gt;
                &lt;/ControlTemplate&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
    &lt;/Style&gt;
</code></pre>

<p>Then I created the Control:</p>

<pre><code>static SearchTextBox()
 {
      DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchTextBox), new FrameworkPropertyMetadata(typeof(SearchTextBox)));             
 }

 TextBox txtFileName = null;

 public TextBox TxtFileName
 {
     get { return txtFileName; }
     set { txtFileName = value; }
 }
 Button btnBrowse = null;

 public Button BtnBrowse
 {
      get { return btnBrowse; }
     set { btnBrowse = value; }
 }
</code></pre>

<p>Now I would like to access this button and text box so I can define their name, content, etc individually.</p>

<p>How can I do it?</p>