xamlのボタンにフォーカスを変更するのに問題があります。私が試みているコードは次のようになります(いくつかの条件が満たされている場合は、フォーカスをボタンに設定する必要があります。奇妙なことに、テスト目的でボタンの背景も変更しており、このプロパティはそれぞれに設定されています条件が満たされる時間デフォルトのボタンを設定したり、そのボタンにフォーカスを設定したりするにはどうすればよいですか?
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=SomeProperty1.Count, Converter={StaticResource IntegerToBooleanConverter}}" Value="True"/>
<Condition Binding="{Binding Path=SomeProperty2, Converter={StaticResource NullToBoolConverter}}" Value="False"/>
<Condition Binding="{Binding Path=SomeProperty3.Count, Converter={StaticResource IntegerToBooleanConverter}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>
<Setter Property="IsDefault" Value="True"/>
<Setter Property="Background" Value="Green"/>
</MultiDataTrigger>
</Style.Triggers>
さらに、SomeProperty1とSomeProperty2は、特定のボタンをクリックした場合にのみ設定されることを書きたいと思います。ご覧のとおり、これらのボタンにフォーカスがあります。