如何使DataSourceCriteria依赖于XAF中的属性?

时间:2012-03-10 09:01:24

标签: devexpress xaf

我使用eXpressApp Framework开发Windows应用程序。我想根据类中的枚举属性过滤查找视图属性编辑器。 这是我的代码: 类别Calss:

    private TranType tranType;
    public TranType TranType
    {
        get
        {
            return tranType;
        }
        set
        {
            SetPropertyValue("TranType", ref tranType, value);
        }
    }

    private string categoryName;
    public string CategoryName
    {
        get
        {
            return categoryName;
        }
        set
        {
            SetPropertyValue("CategoryName", ref categoryName, value);
        }
    }

    private Category parentCategory;
    public Category ParentCategory
    {
        get
        {
            return parentCategory;
        }
        set
        {
            SetPropertyValue("ParentCategory", ref parentCategory, value);
        }
    }

Tran Class:

    private Category category;
    [DataSourceCriteria("TranType == TranType")]
    public Category Category
    {
        get
        {
            return category;
        }
        set
        {
            SetPropertyValue("Category", ref category, value);
        }
    }

    private static TranType myTranType;
    [ImmediatePostData]
    public TranType MyTranType
    {
        get
        {
            return myTranType;
        }
        set
        {
            SetPropertyValue("MyTranType", ref myTranType, value);
        }
    }

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

如果您要做的是在Tran类的视图中过滤查找中的可用类别,那么就这样说吧

private Category category;
[DataSourceCriteria("MyTranType")]
public Category Category
{
    get
    {
        return category;
    }
    set
    {
        SetPropertyValue("Category", ref category, value);


     }
}
private static TranType myTranType;
[ImmediatePostData]
public TranType MyTranType
{
   get
   {...

请查看此文档http://documentation.devexpress.com/#Xaf/CustomDocument2681