Culture Support

With the 2019.2.729 version of UI for WPF, the QueryableDataProvider exposes a Culture property. It makes it possible to localize the underlying data using the CurrentCulture of the user or any other Culture. For example, this will allow you to display the names of the months in the desired language, use the currency symbol from the specified culture and format the values with the correct separator.

Setting QueryableDataProvider Culture

You can easily apply the required culture by setting the Culture property of the QueryableDataProvider.

Example 1: Setting the Culture in xaml

<pivot:QueryableDataProvider x:Key="LocalDataProvider" Culture="en-US"> 
    ... 
</pivot:QueryableDataProvider> 

Example 2: Setting the Culture in code

var dataProvider = new QueryableDataProvider { Culture = new CultureInfo("en-US") }; 
Dim dataProvider = New QueryableDataProvider With {.Culture = New CultureInfo("en-US")} 

By default when there isn't any Culture set the QueryableDataProvider will use InvariantCulture to display the data. In this case the currency symbol from the CurrentCulture will be displayed.

Changing QueryableDataProvider Culture at Runtime

If you would like to change the Culture at runtime you will need to manualy reset the Source of the QueryableDataProvider and set the new Culture. For example, if the QueryableDataProvider is defined as a StaticResource in XAML you will be able to easily change the Culture as shown below:

Example 3: Changing the Culture at Runtime

var provider = this.Resources["QueryableProvider"] as QueryableDataProvider; 
var source = provider.Source; 
provider.Source = null; 
provider.Culture = new CultureInfo("fr-FR"); 
provider.Source = source; 
Dim provider = TryCast(Me.Resources("QueryableProvider"), QueryableDataProvider) 
Dim source = provider.Source 
provider.Source = Nothing 
provider.Culture = New CultureInfo("fr-FR") 
provider.Source = source 

See Also

In this article
Not finding the help you need? Improve this article