【发布时间】:2017-08-31 16:34:21
【问题描述】:
我有这个代码:
.xaml:
<DataTrigger Binding="{Binding Path=TypeItem}" Value="{x:Static local:CListBoxItem+ETypeItem.File}">
...
</DataTrigger>
.cs:
public CListBoxItem(ETypeItem _type)
{
this.TypeItem = _type;
InitializeComponent();
}
...
public enum ETypeItem { File, Directory }
...
public static readonly DependencyProperty TypeItemProperty =
DependencyProperty.Register("TypeItem", typeof(ETypeItem), typeof(CListBoxItem), new PropertyMetadata(ETypeItem.Directory));
public ETypeItem TypeItem
{
get { return (ETypeItem) GetValue(TypeItemProperty); }
set { SetValue(TypeItemProperty, value); }
}
当我运行应用程序时,我的风格不起作用。当我使用时:
<DataTrigger Binding="{Binding Path=TypeItem}" Value="{x:Null}">
...
</DataTrigger>
然后工作..如何让TypeItem加载自己的风格?
【问题讨论】:
标签: c# wpf properties triggers datatrigger