How i can bind the XamGrid Data as per calture
Is that "as per culture"? What are you trying to do? Display numeric values based on the main threads culture?
Hi ,
Actually I want to display data in Grid using localization
I am binding list to the grid and all column are showing currency.
So if localization is set to Argentina then I want to show it by their format.
Off the TextColumn, which is the default column type for numerics, there is a property called FormatString which allows you to set the FormatString which will be used.
You should set it on your currency fields to {}{0:C}
hi,
I create the column in Columnlayout assign event like
CellTemp =
new StringBuilder();
CellTemp.Append(
"<DataTemplate ");
"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");
"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> ");
"<Grid>");
" <TextBlock x:Name=\"txtVal\" Text=\"{Binding CurrencyValue,StringFormat='C'}\" Margin=\"0\" HorizontalAlignment=\"Left\"/>");
" </Grid>");
" </DataTemplate>");
e.ColumnLayout.Columns.Add(
new TemplateColumn()
{
HeaderText =
"SubForm ID",
Key =
"SubFormID",
Width =
new ColumnWidth(60, false),
MinimumWidth = 62,
IsSortable =
false,
Visibility = System.Windows.
Visibility.Visible,
IsResizable =
true,
ItemTemplate = (
DataTemplate)XamlReader.Load(CellTemp.ToString())
Here formating is set for default calture but if i change the calture then it always shows US calture.
It appears to be an issue with SL
http://timheuer.com/blog/archive/2010/08/11/stringformat-and-currentculture-in-silverlight.aspx
You would need to set the Language value of the Form to accept the current culture.