Note that there are some explanatory texts on larger screens.

plurals
  1. PORaising a button clicked event from a style in a WPF text box
    primarykey
    data
    text
    <p>I have a style for a WPF text box which looks some thing like this. The template has a button on whose button clicked event i need the text to be set to empty. Can someone tell what am i missing. Or how can I call a method inside the custom SearchTextBox say ( OnButtonClikced) custom method</p> <pre><code> &lt;Style TargetType="{x:Type DevExGrdDemo:SearchTextBox}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type DevExGrdDemo:SearchTextBox}"&gt; &lt;Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"&gt; &lt;Grid x:Name="LayoutGrid"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight}" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;ScrollViewer x:Name="PART_ContentHost" Grid.Column="0" Margin="2" /&gt; &lt;Label x:Name="LabelText" Grid.Column="0" Margin="2" Content="Search" FontStyle="Italic" Padding="2,0,0,0" /&gt; &lt;Button x:Name="SearchBoxButton" Grid.Column="1" Style="{DynamicResource SearchButton}" &gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="Click" &gt; &lt;"A method residing in the SearchTextBox called on button click"&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="HasText" Value="True"&gt; &lt;Setter TargetName="LabelText" Property="Visibility" Value="Hidden" /&gt; &lt;Setter TargetName="SearchBoxButton" Property="Style" Value="{StaticResource CancelSearchButton}" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsKeyboardFocusWithin" Value="True"&gt; &lt;Setter TargetName="LabelText" Property="Visibility" Value="Hidden" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload