我正在尝试自定义infragistics的xamdatagrid,我想实现特定于我的项目的功能,例如以特定方式启用摘要,并且我想禁用设置摘要选项,该选项是XAML的依赖属性。 / p>
我刚开始使用WPF并想检查这是否可行?我想在这里完成的是隐藏现有的依赖项属性,以便用户无法通过XAML进行设置。
答案 0 :(得分:1)
您可以使用EditorBrowsable属性从XAML隐藏依赖项属性。请看下面的样本。
[EditorBrowsable(EditorBrowsableState.Never)]
public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(MyControl), new PropertyMetadata(0));
此属性在System.ComponentModel命名空间下可用。
答案 1 :(得分:0)
你做不到。除非您创建自己的依赖项属性,然后将其作为普通属性,否则无法从XAML隐藏依赖项属性。既然你提到你正在定制第三方的控制,那么没有。