DataViewBase.RuntimeLocalizationStrings Property
Gets the collection of resource strings that can be localized at runtime. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v18.2.Core.dll
Declaration
public GridRuntimeStringCollection RuntimeLocalizationStrings { get; set; }
Public Property RuntimeLocalizationStrings As GridRuntimeStringCollection
Property Value
Type |
Description |
DevExpress.Xpf.Grid.GridRuntimeStringCollection |
A DevExpress.Xpf.Grid.GridRuntimeStringCollection object that contains resource strings that can be localized at runtime.
|
Individual default strings displayed within the grid (e.g. group panel text, the column chooser’s caption, etc.) can be changed at runtime. To translate individual resource strings at runtime, create a DevExpress.Xpf.Grid.RuntimeStringIdInfo object with the specified Id and Value properties, and add it to the View’s RuntimeLocalizationStrings collection. The Id property identifies the required resource string. The Value property specifies a new value for it.
Example
This example shows how to change default strings displayed within the Group Panel and the Column Chooser's caption, at runtime.
using System.Windows;
namespace WpfApplication24 {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
gridControl1.ItemsSource = new ProductList();
gridControl1.View.ShowColumnChooser();
}
}
}
<Window x:Class="WpfApplication24.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid">
<Grid>
<dxg:GridControl AutoPopulateColumns="True" Name="gridControl1">
<dxg:GridControl.View>
<dxg:TableView Name="tableView1" ShowTotalSummary="True">
<dxg:TableView.RuntimeLocalizationStrings>
<dxg:GridRuntimeStringCollection>
<dxg:RuntimeStringIdInfo Id="GridGroupPanelText" Value="Group Panel"/>
<dxg:RuntimeStringIdInfo Id="ColumnChooserCaption" Value="Hidden Columns"/>
</dxg:GridRuntimeStringCollection>
</dxg:TableView.RuntimeLocalizationStrings>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</Window>
using System.Collections.Generic;
using System.Collections.ObjectModel;
public class Product {
public string ProductName { get; set; }
public string Country { get; set; }
public string City { get; set; }
public double UnitPrice { get; set; }
public int Quantity { get; set; }
}
public class ProductList : ObservableCollection<Product> {
public ProductList()
: base() {
Add(new Product() { ProductName = "Chang", Country = "UK", City = "Cowes", UnitPrice = 19, Quantity = 10 });
Add(new Product() { ProductName = "Gravad lax", Country = "Italy", City = "Reggio Emilia", UnitPrice = 12.5, Quantity = 16 });
Add(new Product() { ProductName = "Ravioli Angelo", Country = "Brazil", City = "Rio de Janeiro", UnitPrice = 19, Quantity = 12 });
Add(new Product() { ProductName = "Tarte au sucre", Country = "Germany", City = "QUICK-Stop", UnitPrice = 22, Quantity = 50 });
Add(new Product() { ProductName = "Steeleye Stout", Country = "USA", City = "Reggio Emilia", UnitPrice = 18, Quantity = 20 });
Add(new Product() { ProductName = "Pavlova", Country = "Austria", City = "Graz", UnitPrice = 21, Quantity = 52 });
Add(new Product() { ProductName = "Longlife Tofu", Country = "USA", City = "Boise", UnitPrice = 7.75, Quantity = 120 });
Add(new Product() { ProductName = "Alice Mutton", Country = "Mexico", City = "México D.F.", UnitPrice = 21, Quantity = 15 });
Add(new Product() { ProductName = "Alice Mutton", Country = "Canada", City = "Tsawwassen", UnitPrice = 44, Quantity = 16 });
}
}
Imports Microsoft.VisualBasic
Imports System.Windows
Namespace WpfApplication24
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
gridControl1.ItemsSource = New ProductList()
gridControl1.View.ShowColumnChooser()
End Sub
End Class
End Namespace
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Public Class Product
Private privateProductName As String
Public Property ProductName() As String
Get
Return privateProductName
End Get
Set(ByVal value As String)
privateProductName = value
End Set
End Property
Private privateCountry As String
Public Property Country() As String
Get
Return privateCountry
End Get
Set(ByVal value As String)
privateCountry = value
End Set
End Property
Private privateCity As String
Public Property City() As String
Get
Return privateCity
End Get
Set(ByVal value As String)
privateCity = value
End Set
End Property
Private privateUnitPrice As Double
Public Property UnitPrice() As Double
Get
Return privateUnitPrice
End Get
Set(ByVal value As Double)
privateUnitPrice = value
End Set
End Property
Private privateQuantity As Integer
Public Property Quantity() As Integer
Get
Return privateQuantity
End Get
Set(ByVal value As Integer)
privateQuantity = value
End Set
End Property
End Class
Public Class ProductList
Inherits ObservableCollection(Of Product)
Public Sub New()
MyBase.New()
Add(New Product() With {.ProductName = "Chang", .Country = "UK", .City = "Cowes", .UnitPrice = 19, .Quantity = 10})
Add(New Product() With {.ProductName = "Gravad lax", .Country = "Italy", .City = "Reggio Emilia", .UnitPrice = 12.5, .Quantity = 16})
Add(New Product() With {.ProductName = "Ravioli Angelo", .Country = "Brazil", .City = "Rio de Janeiro", .UnitPrice = 19, .Quantity = 12})
Add(New Product() With {.ProductName = "Tarte au sucre", .Country = "Germany", .City = "QUICK-Stop", .UnitPrice = 22, .Quantity = 50})
Add(New Product() With {.ProductName = "Steeleye Stout", .Country = "USA", .City = "Reggio Emilia", .UnitPrice = 18, .Quantity = 20})
Add(New Product() With {.ProductName = "Pavlova", .Country = "Austria", .City = "Graz", .UnitPrice = 21, .Quantity = 52})
Add(New Product() With {.ProductName = "Longlife Tofu", .Country = "USA", .City = "Boise", .UnitPrice = 7.75, .Quantity = 120})
Add(New Product() With {.ProductName = "Alice Mutton", .Country = "Mexico", .City = "México D.F.", .UnitPrice = 21, .Quantity = 15})
Add(New Product() With {.ProductName = "Alice Mutton", .Country = "Canada", .City = "Tsawwassen", .UnitPrice = 44, .Quantity = 16})
End Sub
End Class
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RuntimeLocalizationStrings property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
See Also