"Find" name or value of property in Property Grid (property grid is tree structure)
-
Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.
-
Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.
You would start by going back over your class notes to see how the instructor has taught you to do it. Then you make an attempt at your own homework. When that fails, show us what you have done and we'll walk you through the solution. Cheers.
I wasn't, now I am, then I won't be anymore.
-
You would start by going back over your class notes to see how the instructor has taught you to do it. Then you make an attempt at your own homework. When that fails, show us what you have done and we'll walk you through the solution. Cheers.
I wasn't, now I am, then I won't be anymore.
Maybe I did not explained the question properly. I am not a beginner n C# :^) i am not looking for answer a.B.C.x etc to access the value. I want the answer in tree and propertygrid perspective. I have a form with tree structure on left side and property grid on right side. When I load the form by adding object A to tree structure I can see the properties in propertygrid on right hand side, that is fine. I can see B,C and x,y,z and I can modify it. That is fine too. Now I want to add a menu option like visual studio "Find" to find the name or value based on the search condition. So in my example I want to search name "x" in the tree. The output should highlight x and show its value in the property grid. I tried to use propertydescriptor to get properties of A, so it gives me I have property B but how can I access class C and its property dynamically. Let me know if my problem is not clear.
-
Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.
-
Maybe I did not explained the question properly. I am not a beginner n C# :^) i am not looking for answer a.B.C.x etc to access the value. I want the answer in tree and propertygrid perspective. I have a form with tree structure on left side and property grid on right side. When I load the form by adding object A to tree structure I can see the properties in propertygrid on right hand side, that is fine. I can see B,C and x,y,z and I can modify it. That is fine too. Now I want to add a menu option like visual studio "Find" to find the name or value based on the search condition. So in my example I want to search name "x" in the tree. The output should highlight x and show its value in the property grid. I tried to use propertydescriptor to get properties of A, so it gives me I have property B but how can I access class C and its property dynamically. Let me know if my problem is not clear.
I want the answer in tree and propertygrid perspective. ???