Hi,
Is it possible to keep tracking last selected property ? i.e user expanded couple of levels down to some property Xafter changing selected object I would like to automatically expand the properties down to the same property X if it is the same object type with the same properties so the user dos not have to do it manually over and over again when he want to compare property X between instances ?
Best regardsKrzysztof
Hi Michael,
sorry, it does not work, please find attached sample, it crashes the app (nullref exc in xampropertygrid)really wasted too much time on sth what should be simple functionality and it needs hacks (reflection)please look at the sample app (used latest 2020 version).Best regards,Krzysztof1007.WpfApp2.zip
Hello Krzysztof,
Thank you for the update. If you want to expand an item you would set IsExpanded on the item to true. You would then look at the children collection to get its children and proceed down the chain.
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.propertygriditem~isexpanded
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.propertygriditem~children
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.propertygriditem_members
it is a little bit different scenario and this will not work that easy ...it is not only the case to remember the last selected propertyitem for an selectedobject -> when different instance is displayed in propertygrid I want to expand down to the property with the same name (in fact in the same path) programmatically as user did for first instance
lets assume you have on the left side list of an objects X, on the right the property grid1. user selects X1 -> PropertyGrid.SelectedObject = X12. user expands the properties i.e RootProp -> Prop1 -> Prop2 -> and selects 'Name'3. user selects from the list different object -> PropertyGrid.SelectedObject = X2 here I want to expand down to the 'Name' for this instance of X, at this point the Prop1, Prop2 and Name are not yet generatedalso without reflection it is not possible to get the properties path -> SourceObject of PropertyGridPropertyItem is internal as well as ParentItem property.
so the question is:when SelectedObject is changed to different instance of an object X how to programmatically expand multiple levels down to specific property ?P.Seither calling Select() on a PropertyGridPropertyItem or assiging PropertyGrid.SelectedItem does not workBest regards,Krzysztof
Thank you for contacting Infragistics Developer Support.
You can use the SelectedItem property and store it to keep track of the last selected item. You can also use the SelectedItemChanged event which will have both the old and new selected item so you can compare them. And the PropertyGridProertyItem will have information on that item:
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.xampropertygrid~selecteditem
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.xampropertygrid~selecteditemchanged_ev
www.infragistics.com/.../infragisticswpf.controls.editors.xampropertygrid~infragistics.controls.editors.propertygridpropertyitem