Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Style with Data Trigger for TextBox

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="RSS Reader">          <StackPanel xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="200">   <StackPanel.Resources>     <Style TargetType="{x:Type TextBox}">       <Style.Triggers>         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="disabled">           <Setter Property="IsEnabled" Value="False"/>         </DataTrigger>       </Style.Triggers>       <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=Text}"/>     </Style>   </StackPanel.Resources>   <TextBox Margin="3"/> </StackPanel> </Window>