Hello friend,
Hope someone can help me on this:
I am facing with a issue when binding propertyGrid with 'interface type' in ViewModel class:
public class MainViewModel {
public IParent Parent
{
get;
set;
}
public Parent : IParent
public Parent(string name, IChild child)
this.ParentName = name;
this.Child= child;
string ParentName {get;set;}
IChild Child {get;set;}
public class Child : IChild
public string ChildName {get;set;}
public int Age {get;set;}
public interface IParent
public interface IChild
string ChildName {get;set;}
int Age {get;set;}
and when bind it to PropertyGrid
MainViewModel vm = new MainViewModel();
vm.Parent = new Parent() { ParentName = "ParentName", Child = new Child(){ChildName = "ChildName ", Age = 3} };
propGrid1.SelectedObject = vm;
then I can expand Parent but I can NOT expand 'Child'' properties.
I am confused what wrong I am going now? Could someone please give me an explaination.
Thank you,
BR
Hello, BR
I have been looking into the code snippet that you have provided. I created sample application based on your scenario. Would you please modify it with the functionality, that you are using, so it reproduces the issue or send me an isolated sample application where I can reproduce it. This way I would be able to further investigate this for you and provide you with more detailed information on this matter.
Looking forward to hearing from you
Sincerely,
Horen
Software Developer
Infragistics
Hello Horen,
Hope you are doing well and sorry for long response. You created exactly what I faced with. I only have a question that why PropertyGrid can't show any Parent's properties including IChild 'type' property?
Thank you for your evaluation time.
Best regards,
Binh
Hello Binh,
If you change the properties of the Parent class to public tell will show up in the property grid. I have attached an updated sample.
Thank you for contacting Infragistics.
Hello,
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
Dear Horen,
I am sorry for long response, I highly appreciate your support. I follow your instruction to request this new feature on your website
Once again, thank you very much
Thanks for your feedback. I have been looking into it and just to be clear in order to be able to achieve the functionality you are looking for, what I can suggest is to make your properties in the Parent to be public instead private. Here is a snippet.
public class Parent : IParent
this.Child = child;
public string ParentName { get; set; }
public IChild Child { get; set; }
I have attached an updated project.
If you have any further questions on this matter please do not hesitate to let me know.