The cell content gets clipped when the width of the previous column changes at runtime. This happens in the Windows11 and Office2019 themes (possibly in others) and only if the clipped cell is position before the right frozen columns area.
To work this around, you can call the Rebind() method of RadGridView, after the column width changes.
The Clear Filters option in the FieldFilterControl cannot be selected when the DefaultOperator1 is set in the FilterOperatorsLoading event of RadGridView. The FieldFilterControl is the element shown under the column header when the FilteringMode property of RadGridView is set to FilterRow. Setting e.DefaulteOperator1 in the FilterOperatorsLoading properly selects the corresponding filter in the drop down, but after that you cannot select Clear Filters when clicking on this option.
To work this around, you can use the CellLoaded event instead of FilterOperatorsLoading. This will allow you to get the FieldFilterControlViewModel and set its SelectedOperatorViewModel property.
private void manualGridView_CellLoaded(object sender, CellEventArgs e)
{
if (e.Cell is GridViewHeaderCell && e.Cell.Column.UniqueName == "MyColumn")
{
Dispatcher.BeginInvoke(new Action(() =>
{
var fieldFilter = e.Cell.FindChildByType<FieldFilterControl>();
var viewModel = (FieldFilterControlViewModel)fieldFilter.DataContext;
viewModel.SelectedOperatorViewModel = viewModel.AvailableOperatorViewModels.FirstOrDefault(x => x.FilterOperator == FilterOperator.IsLessThan);
}));
}
}
The height of the column footer is not updated properly to autofit the footer's content. Actually, this works when the footer content becomes bigger than the current (or the default) value, but if you change the content with a smaller one, the bigger height remains. In other words, the footer height autofits when the content becomes bigger but it doesn't decrease when the content becomes smaller after that.
To work this around, you can subscribe to the CellLoaded event and use reflection to update one of the internal properties of the panel that draws the footer cells.private void gridView_CellLoaded(object sender, CellEventArgs e)
{
if (e.Cell is GridViewFooterCell)
{
var row = e.Cell.ParentRow;
Dispatcher.BeginInvoke(new Action(() =>
{
var aggregatesList = row.ChildrenOfType<AggregateResultsList>(); // the exact type of children that should be used to get the new height may vary based on your column Footer contents
if (aggregatesList.Count() > 0)
{
var height = aggregatesList.Max(x => x.ActualHeight);
var cellsPanel = e.Cell.ParentOfType<GridViewCellsPanel>();
PropertyInfo minRowHeightProp = cellsPanel.GetType().GetProperty("MinRowHeight", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
object minRowHeightPair = minRowHeightProp.GetValue(cellsPanel);
PropertyInfo heightProp = minRowHeightPair.GetType().GetProperty("Second");
heightProp.SetValue(minRowHeightPair, height);
}
}));
}
}
Arrow keys (up and down) don't scroll the first row which is outside of the viewport. One way to reproduce this is to scroll down, then select the topmost visible row and press the Up arrow key in order to select the row above. This should scroll the view a bit up in order to see the previous row which is now selected.
Currently, this doesn't work when using a custom implementation of the GridViewCell class.
The issue is reproducible when GroupRenderMode is set to Flat.
To work this around, you can manually scroll to the row.
public MainWindow()
{
InitializeComponent();
this.gridView.AddHandler(RadGridView.KeyUpEvent, new KeyEventHandler(OnGridViewKeyUp), true);
}
private void OnGridViewKeyUp(object? sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Up || e.Key == Key.Down)
{
Dispatcher.BeginInvoke(new Action(() =>
{
var currentCell = gridView.CurrentCell;
var row = currentCell.ParentRow;
// Since the VisualOffset proeprty is protected and you are already inheriting the GridViewRow class, you can just expose it through an extra property in the CustomGridViewRow, instead of using reflection like in this example.
var visualOffsetPropInfo = typeof(Visual).GetProperty("VisualOffset", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var offset = (Vector)visualOffsetPropInfo.GetValue(row);
if (offset.Y < 0)
{
row.BringIntoView();
}
}));
}
}
InvalidCastException is thrown when the DropIndicatorThickness property of the GridViewHeaderCell is set. Or whenever the DropIndicatorBrush property is accessed. This happens when using the Windows 7 theme. Also, the EnableColumnVirtualization property should be set to False.
System.InvalidCastException: 'Unable to cast object of type 'System.Windows.Media.LinearGradientBrush' to type 'System.Windows.Media.SolidColorBrush'.'
To work this around, you can use an implicit style targeting the GridViewHeaderCell in order to set its DropIndicatorBrush to a SolidColorBrush value.
<telerik:RadGridView.Resources>
<Style TargetType="telerik:GridViewHeaderCell">
<Setter Property="DropIndicatorBrush" Value="White" />
<Setter Property="DropIndicatorThickness" Value="10" />
</Style>
</telerik:RadGridView.Resources>