Hi,
I want to show the properties of an nested object a runtime. I defined a enumeration on which the object is created.
01.namespace RadGridView_SL4_AR_1202.{03. /// <summary>04. /// A football position.05. /// </summary>06. public enum Position07. {08. GK, // create a GKPositionBehaviour 09. DF, // create a DFPositionBehaviour 10. MF, // create a MFPositionBehaviour 11. FW // create a FWPositionBehaviour 12. }13. 14. public class GKPositionBehaviour15. {16. public int A { get; set; }17. }18. 19. public class DFPositionBehaviour20. {21. public int B { get; set; }22. }23. 24. public class MFPositionBehaviour25. {26. public int C { get; set; }27. }28. 29. public class FWPositionBehaviour30. {31. public int D { get; set; }32. }33. 34.}Here is my viewmodel which does the instantiation of of the object.
01.namespace RadPropertyGridTester02.{03. public class MyViewModel : INotifyPropertyChanged04. {05. 06. private Position position = Position.DF;07. public Position Position08. {09. get10. {11. return position;12. }13. 14. set15. {16. position = value;17. switch (position)18. { 19. case Position.DF:20. Behavior = new DFPositionBehaviour();21. break;22. case Position.GK:23. Behavior = new GKPositionBehaviour();24. break;25. case Position.MF:26. Behavior = new MFPositionBehaviour();27. break;28. case Position.FW:29. Behavior = new FWPositionBehaviour();30. break;31. }32. 33. OnPropertyChanged("Position");34. }35. }36. 37. private Object behavior = new DFPositionBehaviour();38. public Object Behavior39. {40. get41. {42. return behavior;43. }44. 45. set46. {47. behavior = value;48. OnPropertyChanged("Behavior");49. }50. }51. // abbreviated for clarity52. }53.}When I start the program, the initial look is as expected, but when I change the property in the "Position" combo box, the property name of my Behavior object is not updated at all.
After changing to Position GK the value for the property name is supposed to be "A" and not "B".
How do i work around this bug?