View previous topic :: View next topic |
Author |
Message |
mutouaa
Joined: 07 Nov 2007 Posts: 24
|
Posted: Mon Oct 25, 2010 3:27 pm Post subject: {} issue in tree control |
|
|
Hi Infralution team,
here is the sample I met the {} issue. here i want to set the cell value in the tree GetCellData event handler, so i set e.CellData.Format as following:
e.CellData.Format = string.Format("{0}{1}", folder.Code, folder.IsDescriptionNull() ? "" : " - " + folder.Description);
if the folder.Description contains {}, the tree control gets corrupt. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Oct 26, 2010 12:24 am Post subject: |
|
|
The Format property must be set to a valid format string. It can (but doesn't have to) contain a placeholder for the cell Value eg "{0}". If you want to include { or } characters that are not part of the placeholder then you must escape them (by doubling them). For instance if you wanted the actual cell text to be "{MyTitle: MyValue}" where MyValue was the cellData.Value then your format string would need to be:
"{{MyTitle: {0}}}"
An alternative is to set the CellData.Format = null and set the CellData.Value to the text you want to display directly. If the CellData.Format is null then the cell value is not formatted using the Format but is just displayed directly. This won't work however if you are using an editor control to edit the cell value and you want the displayed cell text to be different to the value that is edited and stored in the data.
The next release of Virtual Tree (3.16.0) will have an explicit property "FormatCellText" to control whether the cell text is formatted (rather than just checking if CellData.Format is null). _________________ Infralution Support |
|
Back to top |
|
|
mutouaa
Joined: 07 Nov 2007 Posts: 24
|
Posted: Tue Oct 26, 2010 2:31 am Post subject: |
|
|
thank you very much for your quick reply |
|
Back to top |
|
|
|