【问题标题】:Category attribute does not work on PropertyGrid类别属性在 PropertyGrid 上不起作用
【发布时间】:2015-11-15 11:29:10
【问题描述】:

我有课,必须在 PropertyGrid 上显示(来自 WPF 工具包)

 public class VertexProperties
{
    private readonly Point2DU _vertex;
    private readonly ChainViewModel _chainViewModel;
    private readonly F2d _segment;
    [Category("Vertex")]
    public double X
    {
        get { return _vertex.X; }
        set
        {
            _vertex.X = value;
            _chainViewModel.RefreshAll();
        }
    }
    [Category("Vertex")]
    public double Y
    {

        get { return _vertex.Y; }
        set
        {
            _vertex.Y = value;
            _chainViewModel.RefreshAll();
        }
    }
    public VertexProperties( Point2DU vertex, ChainViewModel chainViewModel, F2d segment)
    {
        _vertex = vertex;
        _chainViewModel = chainViewModel;
        _segment = segment;
    }
}

但类别没有出现在 PropertyGrid 中。但是,DisplayName 属性可以正常工作。

【问题讨论】:

  • 您能否提供一个示例项目,其中包含 XAML 和演示此问题的代码,或者此问题已消失?

标签: wpf wpftoolkit


【解决方案1】:

SamTheDev 的回答不准确,因为 Vetex 对象是只读的,而不是它的内部属性。您是否确定 PropertyGrid 正在使用类别:

<xctk:PropertyGrid IsCategorized="True" AutoGenerateProperties="True" />

我认为默认情况下应该对网格进行分类。你能展示一下你正在使用的 XAML / Code 吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-19
    • 1970-01-01
    • 1970-01-01
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-06
    相关资源
    最近更新 更多