In Development
Last Updated: 23 May 2024 10:26 by ADMIN
Martin Ivanov
Created on: 20 May 2024 10:16
Category: GridView
Type: Bug Report
0
GridView: InvalidCastException when setting the DropIndicatorThickness of GridViewHeaderCell and the Windows 7 theme is used

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>

0 comments