Unplanned
Last Updated: 17 Feb 2022 08:35 by Dickson

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;
            }
        }

Unplanned
Last Updated: 24 Jan 2022 11:16 by ADMIN

Add a RadFilterView and a RadGridView. Associate the two controls and add programmatically FilterDescriptors to the RadFilterView control. The UI doesn't show any filtering applied. 

        Me.RadFilterView1.FilterViewElement.LoadCategoriesAsync = False
        Me.RadGridView1.DataSource = Me.ProductsBindingSource
        Me.RadGridView1.EnableFiltering = True
        Me.RadGridView1.ShowFilteringRow = False


        AddHandler Me.RadFilterView1.FilterChanged, AddressOf Me.RadFilterView1_FilterChanged
        AddHandler Me.RadFilterView1.FilterViewElement.CategoryCreating, AddressOf Me.FilterViewElement_CategoryCreating
        AddHandler Me.RadFilterView1.FilterViewElement.CategoryCreated, AddressOf Me.FilterViewElement_CategoryCreated

        Me.RadFilterView1.AssociatedControl = Me.RadGridView1

       
        Dim filter As New FilterDescriptor With {
            .PropertyName = "ProductID",
            .Operator = FilterOperator.IsLessThanOrEqualTo,
            .Value = 5,
            .IsFilterEditor = True
        }

        Dim filter2 As New FilterDescriptor With {
            .PropertyName = "CategoryID",
            .Operator = FilterOperator.IsLessThanOrEqualTo,
            .Value = 4,
            .IsFilterEditor = True
        }
        Me.RadFilterView1.FilterDescriptors.AddRange(filter, filter2)

Unplanned
Last Updated: 07 Jan 2022 07:31 by ADMIN

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;
        }
 

Completed
Last Updated: 14 Oct 2021 16:30 by ADMIN
Release R3 2021 SP1

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'."