Completed
Last Updated: 07 Nov 2023 06:57 by ADMIN
Release R3 2023 SP1
Stenly
Created on: 15 Sep 2023 13:19
Category: TreeListView
Type: Bug Report
0
TreeListView: Columns are resized when a filter is applied when the last column's Width is set to Star
When the last column's Width is set to "*", applying a filter will resize the columns.

A possible workaround would be the following one:
private void RadTreeListView_Filtering(object sender, Telerik.Windows.Controls.GridView.GridViewFilteringEventArgs e)
{
    var treeListView = sender as RadTreeListView;
    var internalColumns = treeListView.GetType().GetProperty("InternalColumns", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(treeListView);
    internalColumns.GetType().GetProperty("ColumnWidthsCalculationPending", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(internalColumns, true);
}

private void RadTreeListView_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
{
    Dispatcher.BeginInvoke(new Action(() =>
    {
        var treeListView = sender as RadTreeListView;
        var internalColumns = treeListView.GetType().GetProperty("InternalColumns", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(treeListView);
        internalColumns.GetType().GetProperty("ColumnWidthsCalculationPending", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(internalColumns, false);
    }), System.Windows.Threading.DispatcherPriority.Loaded);
}
0 comments