Skip to content

PropertyGrid绑定的对象与Prism提供的基类不兼容 #486

Closed

Description

@tzm1119

BindableBase是Prism框架提供的实现INotifyPropertyChanged接口的基类,我把下面的类绑定到PropertyGrid上时,直接报错了

public class PropertyGridDemoModel:BindableBase
{
private string bValue="66";
public string BValue
{
get { return bValue; }
set { SetProperty(ref bValue, value); }
}
}
这个异常还没法看详细信息
image

Activity

  1. tzm1119 commented on Sep 29, 2020

    @tzm1119
    Author

    BindableBase是Prism框架提供的实现INotifyPropertyChanged接口的基类,我把下面的类绑定到PropertyGrid上时,直接报错了

    public class PropertyGridDemoModel:BindableBase
    {
    private string bValue="66";
    public string BValue
    {
    get { return bValue; }
    set { SetProperty(ref bValue, value); }
    }
    }
    这个异常还没法看详细信息
    image

    我已经找到问题了,是因为下面的小括号造成的,只要对象实现了INotifyPropertyChanged,如果添加小括号,就会报错
    image

  2. AlexVinci commented on Jan 6, 2022

    @AlexVinci

    ImagePropertyEditor中override了CreateBinding方法,小括号未删除,所以实现了INotifyPropertyChanged的类,并包含ImageSource属性的话,仍有这个问题。
    ImagesourceEditor
    BaseEditor

  3. added a commit that references this issue on Mar 2, 2025
    940117a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址