View previous topic :: View next topic |
Author |
Message |
Graham Guest
|
Posted: Thu Oct 27, 2005 12:23 am Post subject: Displaying multiple icon images in MainColumn |
|
|
I would like to display up to two icons in the main column of my VirtualTree (in list mode).
Can you explain how to go about doing this?
My implementation so far sets only one icon in a handler for the GetRowData event: to the event property e.RowData.Icon. The only other property avalable is e.RowData.ExpandedIcon, which seems an unlikely option given that this is a list, not a tree.
I'm looking for a feature similar to the SmallImage/StateImage pair available in a standard ListView control.
Thanks in advance,
Graham |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Oct 27, 2005 6:58 am Post subject: |
|
|
There are two ways you could do this. Both involve adding a "Prefix" column. Basically just add a column and set the PrefixColumn property for the column to true. This means that cells for this column will be embedded prior to the text for the main column. Check out the left hand tree in the FileBrowser sample for an example that uses a prefix column. In this case an Editor with a checkbox has been defined for the column and the DisplayMode for the editor has been set to Always.
Using a DisplayMode.Always editor control in the prefix column is the first alternative (as in the FileBrowser sample). You could just use a PictureBox for the control - but this solution is more useful if you want to use a control (such as a checkbox or your own control) that allows the user to interact with the display state. The data that you display in the editor control can be bound to a property of the associated row (using Object binding) or set programmatically by setting the CellData.Value in the GetCellData method/event
The second alternative is probably the best option if you just want to display an icon but don't need user interaction. You set the icon you want to display by setting it in the CellData.Value in the GetCellData method/event (you could use object binding if your item object has an Icon property). Then set the CellData.ShowPreview property to true and the CellData.ShowText property to false. The column will now display the icon. There are some other properties related to displaying graphic previews of data which you can also play with. If you are using Object binding you can just set the corresponding properties for the CellBinding instead of doing this in the GetCellData method/event. _________________ Infralution Support |
|
Back to top |
|
|
|