У меня проблема с свойством IsEnabled моих кнопок.Binding IsEnabled не работает
Это моя кнопка Стиль:
<Style x:Key="Button_selectable" TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="15"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border CornerRadius="5" Background="{TemplateBinding Background}" BorderThickness="1" BorderBrush="Black" Margin="1,1,1,1">
<Grid>
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Tag, RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="Background" Value="MediumSlateBlue"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=Tag, RelativeSource={RelativeSource Self}}" Value="False">
<Setter Property="Background" Value="white"/>
</DataTrigger>
</Style.Triggers>
</Style>
Использование:
<Button Command="{Binding command}" IsEnabled="{Binding Enable}" x:Name="button" Content="Button1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="13.333" Style="{StaticResource Button_selectable}" Tag="{Binding State}"/>
Без моего SYTLE свойство IsEnabled работает правильно. Но если я использую этот Sytle, кнопка всегда включена. Я гугл часов, ... но я ничего не нашел :-(
Спасибо за помощь!
Я попытался это уже. Но это не работает. Мое свойство привязки даже не называется однажды, хотя я использую OnPropertyChanged. – Fruchtzwerg
Ну, это, наверное, еще один вопрос ... –