This is a migrated thread and some comments may be shown as answers.

GridViewCell ContentStringFormat

4 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivano
Top achievements
Rank 1
Ivano asked on 22 Jul 2010, 02:48 PM
I have to format numbers to a user defined precision; I created a binding to a property where precision is stored:

            Binding precisionBinding;
            precisionBinding = new Binding("Item.Format[" + column.UniqueName + "].Precision");
            precisionBinding.Mode = BindingMode.OneWay;
            precisionBinding.Converter = new PrecisionConverter();

and set CellStyle:

            cellStyle.Setters.Add(new Setter(GridViewCell.ContentStringFormatProperty, precisionBinding));

but format returned by PrecisionConverter() is ignored at all.
Thanks

4 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 04:05 PM
Hello Ivano,

 Why don't you try to set the DataFormatString property of the GridViewDataColumn containing the cell to the user-selected precision?

Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ivano
Top achievements
Rank 1
answered on 23 Jul 2010, 09:24 AM
Hi
as far as I know DataFormatString on GridViewDataColumn set string format for all column cells (already done and it works) but I need to set a different precision on some cells.

Thanks
Ivano
0
Yavor Georgiev
Telerik team
answered on 23 Jul 2010, 01:18 PM
Hello Ivano,

 The ContentStringFormat property is inherited from ContentControl and we do not use it internally, except for GridViewHeaderCell. However, you can use the CellTemplateSelector property of GridViewColumn to set a custom string format for each cell. You can learn more about DataTemplate selector here.

We will study your scenario and consider using the ContentStringFormat for GridViewCell.

Sincerely yours,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yavor Georgiev
Telerik team
answered on 23 Jul 2010, 01:20 PM
Hi Ivano,

 I forgot to paste the link: Template Selectors.

Regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Ivano
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Ivano
Top achievements
Rank 1
Share this question
or