$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Data Grid WinForms Control
Create data gird view in C# with modern user interface for your Windows Forms applications
Home > WinForms UI Controls > User Manual > Data Grid Localization in C#

DataGridView Control Localization

The Kettic DataGridView control is a powerful and easy to use data grid control for Windows Forms. This DataGridView control provides large flexibility for developers to customize it. This article will demonstrate how to localize the Kettic DataGridView. Users of the Control can easily localize data grid view control to display control text and messages in a specific language.

Localizing DataGridView in C# Windows Forms

To localize the Kettic DataGridView component in C# Windows Forms application to display control text and messages in a specific language, these prerequisites below must be done in advanced.
  • All C# classes used for localizing of DataGridView are defined in the Kettic.WinForms.UI.Localize namespace.
  • To localize the DataGridView control, we should create a descendant class of KetticLocalizeProvider class in your desired C# Windows Forms project.
  • Then we need to override the GetLocalizedString() method and provide a translation for the label and user messages. Otherwise, the default value will be returned.
  • Call the base GetLocalizedString method in the default clause of the switch statement to guarantee the behavior.

How to Implement the Localization Provider in C#

The following is the example showing how to implement the English localization provider in C# Windows Forms application.

public class MyEnglishKetticGridLocalizationProvider : KetticGridLocalizationProvider
{
public override string GetLocalizedString(string id)
{
switch (id)
{
case KetticGridStringId.FilterFunctionContains: return "Contain";
case KetticGridStringId.FilterFunctionEqualTo: return "Equal";
case KetticGridStringId.FilterFunctionGreaterThan: return "Greater than";
case KetticGridStringId.FilterFunctionIsEmpty: return "Empty";
case KetticGridStringId.FilterFunctionLessThan: return "Less than";
case KetticGridStringId.FilterFunctionNotIsEmpty: return "Not empty";
case KetticGridStringId.FilterFunctionStartsWith: return "Starts with";
case KetticGridStringId.ExpressionFormOKButton: return "OK";
case KetticGridStringId.ExpressionFormCancelButton: return "Cancel";
}

return string.Empty;
}
}
Then we can use a simple C# code snippet to apply the custom localization provider to DataGridView control by instantiating and assigning the custom localization provider to the current one

KetticGridLocalizationProvider.CurrentProvider = new MyEnglishKetticGridLocalizationProvider();
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls