3
私はカスタムTitleBarでWPFアプリケーションを作成しています。カスタムボタンスタイルもあります。私は両方のカスタムコントロールを完全に作成しましたが、サイズ変更ボタンを作成している間に、ウィンドウの状態の問題のキャプションが変更されました。カスタムコントロールのXAMLコードは...データトリガーでラベルのカスタムプロパティを使用できません
<local:MaterialButton Grid.Column="7" BackStyle="{StaticResource StyleWhite}">
<local:MaterialButton.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Value="Normal">
<Setter Property="Caption" Value="" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Value="Maximized">
<Setter Property="Caption" Value="" />
</DataTrigger>
</local:MaterialButton.Triggers>
</local:MaterialButton>
と背後にあるコードは...
public string Caption
{ get { return (string)GetValue(CaptionProperty); }
set { SetValue(CaptionProperty, value); }
}
public static readonly DependencyProperty CaptionProperty =
DependencyProperty.Register("Caption", typeof(string), typeof(MaterialButton));
である。この
完全なxamlを提供できますか? – Parag
バインディングエラーが発生していることを確認するために出力ウィンドウを確認してください。DPが正常に表示されます。 –
あなたの問題は何ですか?また、MaterialButtonのコード、 "StyleWhite"、およびMaterialButtonのデフォルトスタイルを投稿してください。 – mm8