Private Sub Filter_CategoryCreating(sender As Object, e As FilterViewCategoryCreatingEventArgs)
AddHandler DirectCast(e.Category, FilterViewBooleanCategoryElement).ItemCreated, AddressOf BoolCategoryItemCreated
In some themes the clear filter ellipse button is visible, nevertheless, no filter is applied.
It is observable in ControlDefault, Office2010Silver, Office2007Black, Office2007Silver, and Windows7.
As a workaround, you can consider using one of our latest themes: Fluent for example.
Use the following code snippet which result is illustrated in the gif file:
public RadForm1()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Column1", typeof(decimal));
dt.Columns.Add("Column2", typeof(string));
dt.Columns.Add("Column3", typeof(string));
for (int i = 0; i < 10; i++)
{
//No delay
//dt.Rows.Add(i, 100, "LongstringAAAAAA" + i, "VeryVeryLongstringAAAAAAAABBBBBBBBVeryVeryLongstringAAAAAAAABBBBBBBBE" + i);
//Long delay
dt.Rows.Add(i, 10000, "LongstringAAAAAA" + i, "VeryVeryLongstringAAAAAAAABBBBBBBBVeryVeryLongstringAAAAAAAABBBBBBBBE" + i);
}
this.radFilterView1.DataSource = dt;
}
Workaround:
private void radFilterView1_CategoryCreating(object sender, Telerik.WinControls.UI.FilterView.FilterViewCategoryCreatingEventArgs e)
{
FilterViewNumericCategoryElement numericCategory = e.Category as FilterViewNumericCategoryElement;
if (numericCategory!=null)
{
numericCategory.DisplayMode = FilterViewNumericCategoryMode.SpinEditors;
}
}
Use the following code snippet
public RadForm1()
{
InitializeComponent();
DataTable dt = new DataTable();
for (int i = 0; i < 20; i++)
{
dt.Columns.Add("col" + i, typeof(string));
}
for (int i = 0; i < 10; i++)
{
DataRow r = dt.NewRow();
foreach (DataColumn col in dt.Columns)
{
r[col.ColumnName] = Guid.NewGuid().ToString();
}
dt.Rows.Add(r);
}
this.radFilterView1.DataSource = dt;
}
You will notice that after running the project, the vertical scrollbar is missing:
Workaround:
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
MethodInfo mi = typeof(RadFilterViewElement).GetMethod("UpdateScrollbars", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(this.radFilterView1.FilterViewElement, new object[] { this.radFilterView1.FilterViewElement.ElementsPanel.Size });
}
An extended workaround that covers the case for updating the scrollbar at run time is demonstrated here:
private void radFilterView1_CategoryCreated(object sender, Telerik.WinControls.UI.FilterView.FilterViewCategoryCreatedEventArgs e)
{
e.Category.ExpandedChanged += Category_ExpandedChanged;
e.Category.Expanded = false;
}
private void Category_ExpandedChanged(object? sender, EventArgs e)
{
// You need pass the control to Windows main loop to perform the pending telerik events after property Expanded change in order to resize internally
// the StackLayoutPanel Containers before calling UpdateScrollBars
Application.DoEvents();
// Now your code
MethodInfo mi = typeof(RadFilterViewElement).GetMethod("UpdateScrollbars", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(this.radFilterView1.FilterViewElement, new object[] { this.radFilterView1.FilterViewElement.ElementsPanel.Size });
// Hide the horizontal scrolll bar
radFilterView1.FilterViewElement.HorizontalScrollBar.Visibility =ElementVisibility.Collapsed;
}
To reproduce:
this.radGridView1.EnableFiltering = true;
this.radGridView1.BestFitColumns();
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Column 1", Type.GetType("System.Decimal")));
dt.Columns.Add(new DataColumn("Column 2", Type.GetType("System.Decimal")));
dt.Columns.Add(new DataColumn("Column 3", Type.GetType("System.String")));
for (int i = 0; i < 20; i++)
{
dt.Rows.Add(0, i, "Text " + i);
}
this.radGridView1.DataSource = dt;
this.radFilterView1.AssociatedControl = this.radGridView1;
Run the project and filter the first column ("Column 1") by dragging radFilterViews radTrackBar.
You will get the following exception: "System.ArgumentOutOfRangeException: 'Value of '1' is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'."