WPFでは、DataTriggerが添付プロパティにバインドできますか?DataTriggerを添付プロパティにバインドできますか?
私は基本的に、特定の検証規則が破られたときにスタイルを提供するために、添付プロパティでコンバーターを使用したいと考えています。私は、次のようなマークアップを使用しています:
<DataTrigger Binding="{Binding Path=Validation.Errors,
RelativeSource={RelativeSource Self},
Converter={StaticResource RequiredToBoolConverter}}"
Value="True">
<Setter Property="Background" Value="LightGreen" />
</DataTrigger>
をしかし、これを実行すると、私は以下の取得:
System.Windows.Data Error: 39 : BindingExpression path error: 'Validation' property not found on 'object' ''TextBox' (Name='')'. BindingExpression:Path=Validation.Errors; DataItem='TextBox' (Name=''); target element is 'TextBox' (Name=''); target property is 'NoTarget' (type 'Object')
私はDataTrigger結合パスに「テキスト」に変更した場合、私は得ることはありませんデータバインディングエラー(もちろん、私が求めている動作を提供しません)。
これはhttp://msdn.microsoft.com/en-us/library/ms752300.aspx#Path_Syntax –
@MでMSDNに記載されています。 Dudleyリンクはもう働いていません! –
新しいリンク:https://msdn.microsoft.com/library/ms752300%28v=vs.100%29.aspx#Path_Syntax –