3
我正在使用自定义TitleBar制作WPF应用程序。它也有一个自定义按钮样式。虽然我完美地制作了两个自定义控件,但是创建了一个调整大小按钮,用windows状态问题改变它的标题。自定义控件的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