FlexGrid for WinForms
GetLocalizedString Event
Example 



Occurs when the filter localizes a string in the user interface.
Syntax
'Declaration
 
<C1DescriptionAttribute("Fires when a string needs to be localized before being displayed.")>
Public Event GetLocalizedString As GetLocalizedStringEventHandler
'Usage
 
Dim instance As C1FlexGridBase
Dim handler As GetLocalizedStringEventHandler
 
AddHandler instance.GetLocalizedString, handler
[C1Description("Fires when a string needs to be localized before being displayed.")]
public event GetLocalizedStringEventHandler GetLocalizedString
[C1Description("Fires when a string needs to be localized before being displayed.")]
public:
event GetLocalizedStringEventHandler^ GetLocalizedString
Remarks

The C1FlexGrid control automatically localizes the column filter based on the system's current culture and in the setting of the Language property.

This event allows you to customize the filter strings or to implement localization to languages that are not supported by the grid's built-in localization mechanism.

To modify the content of any of the filter's UI elements, handle this event and set the e.Value parameter to the text you would like to display.

Example
The example below shows how you can change the strings in the filter UI based on the string value and on the name of the controls being localized:
void Initialize()
{
  // enable filtering
  _flex.AllowFiltering = true;
  
  // set GetLocalizedString handler
  _flex.GetLocalizedString += _flex_GetLocalizedString;
}
void _flex_GetLocalizedString(object sender, C1.Win.C1FlexGrid.GetLocalizedStringEventArgs e)
{
  // customize item based on text value
  if (e.Value == "(Select All)")
  {
    e.Value = "(Select Everything)";
  }
  
  // customize item based on component name
  switch (e.ComponentName)
  {
    case "_btnApplyFilter":
      e.Value = "OK";
      break;
    case "_btnClearFilter":
      e.Value = "Reset";
      break;
    case "_btnCancel":
      e.Value = "Close";
      break;
  }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

C1FlexGridBase Class
C1FlexGridBase Members

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Send Feedback