|
public class ResourceWrapper
{
const string OrderIDTextName = "OrderIDText";
const string CustomerIDTextName = "CustomerIDText";
const string EmployeeIDTextName = "EmployeeIDText";
public ResourceWrapper()
{
ResourceManager rs = LocalizationDemo.Properties.Resources.ResourceManager;
OrderIDText = rs.GetString(OrderIDTextName, CultureInfo.CurrentUICulture);
CustomerIDText = rs.GetString(CustomerIDTextName, CultureInfo.CurrentUICulture);
EmployeeIDText = rs.GetString(EmployeeIDTextName, CultureInfo.CurrentUICulture);
}
public string OrderIDText { get; set; }
public string CustomerIDText { get; set; }
public string EmployeeIDText { get; set; }
} |
|
// Define the Resource Wrapper
<syncfusion:ChromelessWindow.Resources>
<local:ResourceWrapper x:Key="resourceWrapper"/>
</syncfusion:ChromelessWindow.Resources>
// Bind the values to the column Header Text.
<syncfusion:GridTextColumn
HeaderText="{Binding Path=OrderIDText,Source={StaticResource resourceWrapper}}"
MappingName="OrderID"
TextAlignment="Right" />
<syncfusion:GridTextColumn
HeaderText="{Binding Path=CustomerIDText,Source={StaticResource resourceWrapper}}"
MappingName="CustomerID" />
<syncfusion:GridTextColumn
HeaderText="{Binding Path=EmployeeIDText,Source={StaticResource resourceWrapper}}"
MappingName="EmployeeID"
TextAlignment="Right" /> |
|
##Button Click Codes
private void button_Click(object sender, RoutedEventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ge");
ResourceWrapper wrapper = this.Resources["resourceWrapper"] as ResourceWrapper;
if(wrapper!= null)
{
wrapper.SetResource(LocalizationDemo.Properties.Resources_ge.ResourceManager);
wrapper.OnPropertyChanged("");
}
}
// Get the localized string value using the Resource Manger.
public string OrderIDText
{
get
{
return rs.GetString(OrderIDTextName, CultureInfo.CurrentUICulture);
}
} |