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
|
Lets say I have a collection of items like this:
By default, the collection will be displayed like:
- Collection CollectionType
- Item[0] TypeName
-FirstName John
-LastName Smith
-Age 30
-Gender Male
+ Item[1] TypeName
+ Item[2] TypeName
In the above case I can only edit the items properties by expanding each item.
I would like to have the information displayed as this and be able to display and edit some of the items properties without expanding.
- Some Descriptive Text
- Person John Smith 30
-FirstName John
-LastName Smith
-Age 30
-Gender Male
+ Dog Marley
+ Car Toyota Avensis
Also, I would like to be able to group items within the collection by certain category like Dog, Car, Person, etc.
Can I do this? If so, can someone provide some help/guide?
Thank you!
|
|
|
Fixed my post above:
By default, a collection wouldbe displayed like: - Collection CollectionType - Item[0] TypeName -FirstName John -LastName Smith -Age 30 -Gender Male + Item[1] TypeName + Item[2] TypeName In the above case I can only edit the items properties by expanding each item. I would like to have the information displayed as below while being able to display and edit some of the items properties without expanding them. - Some Descriptive Text - Person John Smith 30 -FirstName John -LastName Smith -Age 30 -Gender Male + Dog Marley + Car Toyota Avensis Also, I would like to be able to group items within the collection by certain category like Dog, Car, Person, etc. Can I do this? If so, can someone provide some help/guide? Thank you! |
|
|
You can get the "edit without expanding" effect using a TypeEditor. See the example for PhoneNumber in the Editors sample. If you still want users to be able to expand the item (e.g. because some properties, like Gender, are not editable at the top level), set AllowExpand="True" on the TypeEditor declaration. To change the text displayed for the collection itself on the left of the grid, use DisplayNameAttribute. To change the text displayed for the collection itself on the right of the grid, use a PropertyEditor with a TextBlock as its content. I can't think of a way to span both columns of the grid with a single piece of descriptive text but you might be able to cobble something together using Grid.ColumnSpan or a negative margin. Changing the caption text for collection entries is a bit tricky if you are using a list (e.g. ObservableCollection). If you are using a dictionary then the caption text is the ToString of the key -- this might be more appropriate for your scenario anyway by the look of it (?). If not you will probably need to do something rather fiddly with the PropertyNameCellTemplate. For grouping items within the collection, you may be able to do this just by setting multiple GroupDescriptions on the BindingView.DefaultView (haven't tested this though). |
|