BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Query |
Response |
Now I would like to replace the same when I open the Dialogbox in the Excelfilter. Is this possible? |
The CheckedListBoxPart items are added from the cellvalue of each records for the column. In order to replace the ExcelFilter values for Boolean column, the CheckBoxOptions property of GridCheckBoxCellInfo class can be used. Please make use of below code and sample,
//To set the filter dialog list values
this.gridGroupingControl1.TableDescriptor.Columns["CheckBox"].Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo("ja", "nein", "", false); |
And I have enabled the EnableDateFilter = true and EnableNumberFiler = true. I have translated the Excel-Filter in German but I don't find a possibility to trasnslate the Number Filter and Date Filter incl. |
A class can be inherited from ILocalizationProvider class to set a localized string for default ExcelFilter items. Please refer to the below code example and sample,
//In Localizer.cs
public string GetLocalizedString(System.Globalization.CultureInfo culture, string name, object obj)
{
switch (name)
{
case "DateTimeFilters":
return "Terminzeit filter";
case "NumberFilters":
return "nummer filter";
case "Office2007FilterDateEquals":
return "Text for equal";
case "Office2007Filterbefore":
return "Text for before";
///For all filter items
}
}
//In Form.cs
#region Localization
Localizer loc = new Localizer();
LocalizationProvider.Provider = loc;
#endregion |
protected override void DrawCheckBox(Graphics g, Rectangle clientBounds, GridStyleInfostyle, ButtonState state, ContentAlignment align, string text, Font font)
{
GridTableCellStyleInfo cellStyle = style as GridTableCellStyleInfo;
if (cellStyle != null && cellStyle.TableCellIdentity != null && cellStyle.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
string cellValue = style.CellValue.ToString();
if (cellValue == "True")
g.DrawString("Ja", style.GdipFont, new SolidBrush(style.TextColor), clientBounds);
if (cellValue == "False")
g.DrawString("Nein", style.GdipFont, new SolidBrush(style.TextColor), clientBounds);
}
} |
Hello,
I have tried your example. But I think it is not working. See my attachment.
BR Thomas
//Event Triggerring
this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += GridGroupingControl1_TableControlCurrentCellShowingDropDown;
GridTableFilterBarCellRenderer renderer;
//Event Customization
private void GridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
renderer = e.TableControl.CurrentCell.Renderer as GridTableFilterBarCellRenderer;
if (renderer.ListBoxPart.Items.Contains("True"))
{
int index = renderer.ListBoxPart.Items.IndexOf("True");
renderer.ListBoxPart.Items[index] = "Ja";
}
if (renderer.ListBoxPart.Items.Contains("False"))
{
int index = renderer.ListBoxPart.Items.IndexOf("False");
renderer.ListBoxPart.Items[index] = "Nein";
}
}
//Event Triggerring
this.gridGroupingControl1.TableControl.DrawCellDisplayText += TableControl_DrawCellDisplayText;
//Event Customization
private void TableControl_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if (e.Style.CellType == "FilterBarCell" && e.Style.CellIdentity.ColIndex == 5)
{
if (e.DisplayText == "True")
e.DisplayText = "Ja";
else if (e.DisplayText == "False")
e.DisplayText = "Nein";
}
} |