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

Set the DataFormatString using style/resource

3 Answers 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Scott Waye asked on 02 Sep 2010, 10:05 PM
Hi,

Is it possible to set the DataFormatString using a style or a StaticResource?  It would be good to specify the format for certain columns in one place and just reference that format in the xaml.

--
Scott

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Sep 2010, 07:58 AM
Hello Scott Waye,

You may define the DataFormatString as a string Resource as follows:

<UserControl.Resources>    
    <sys:String x:Key="DataFormatString">{0:P}</sys:String>                
</UserControl.Resources>

<telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"                                                                    DataFormatString="{Binding Source={StaticResource DataFormatString}}"/>

 

Regards,
Maya
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
Sandi Markon
Top achievements
Rank 1
answered on 22 Sep 2010, 01:17 PM
Thanks, but this is not my scenario! I'd like to localize format string from string resource not static from XAML! How???
0
Maya
Telerik team
answered on 22 Sep 2010, 02:45 PM
Hi Sandi Markon,

Localization of the Caption of an AggregateFunction may be performed by the help of LocalizationManager. More information may be found in this forum thread.
 

All the best,
Maya
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
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Answers by
Maya
Telerik team
Sandi Markon
Top achievements
Rank 1
Share this question
or