This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi,I have a following situation. Class PupilWrapper{ Class Pupil Name Age Height } The propertyGrids SelectedObjects is mapped to an instance of PupilWrapper. For Pupil I want a dropdown ComboBox populated with a list of pupils. Also I want to be able to edit the individual properties (Name, Age, Height) of the currently selected Pupil. I tried using a TypeEditor for Pupil, but with that I can change all the properties of the current pupil but cant change the pupil itself. I didn’t know how to bind the PupilWrapper instance to take a new pupil.(Is this possible, can you give a small sample? ) Then I tried using PropertyEditor and bound the comboBox using <ComboBox ItemsSource="{Binding UnderlyingObject.AdapterImages}" SelectedValue="{Binding Value, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">This updated the PupilWrappers Pupil object to point to a new Pupil based on the SelectedItem in ComboBox, but I also wanted AllowExpand=”True” so that I can edit the selected Pupils properties.When I do that, the editor for all the subnodes is changed the Pupils editor. For Name, Age, Height also I get a drop-down ComboBox.(How is it possible, to retain the template for all the subnodes, while changing the parents editor only). I hope I am clear enough. Please let me know where could I have been wrong.
Thanks in advance
|
|
|
I think you may be trying to do too much inside the property grid here. Obviously I don't know what effect you're aiming for in your UI, but might it not be more appropriate to, for example, have a ComboBox of Pupils *outside* the property grid, for the user to select a Pupil, and then have the PropertyGrid.SelectedObject bound to the SelectedItem/SelectedValue of the ComboBox? My impression is that the "current pupil" sounds more like a piece of application state than a piece of business object state -- though again I am speaking in ignorance of the business context here. The behaviour with editors of sub-properties picking up the editor template of the parent property appears to be a bug with the combination of PropertyEditor, record types, AllowExpand and multiple selection. We will look into a fix for this. If you can use a single-selection approach (i.e. set SelectedObject to the PupilWrapper instead of setting SelectedObjects to an array containing the PupilWrapper) then the issue will go away. |
|