سلام بر تمامی برنامه نویسان عزیز 😉 در این پست کد Style با Data Trigger با wpf و سی شارپ #C را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
تصویر خروجی این کد:
کد Style با Data Trigger با wpf و سی شارپ #C :
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="24" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="24" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=txtbox,
Path=Text.Length}"
Value="0">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="24" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="24" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=txtbox,
Path=Text.Length}"
Value="0">