If you have the following model, the columns that show the Test and Date properties (in the derived class) cannot be sorted or filtered.
public
class
RowModel
{
public
int
Id {
get
;
set
; }
public
Bar FredBar {
get
;
set
; }
}
public
class
Fred : Bar
{
public
DateTime Date {
get
;
set
; }
public
string
Test {
get
;
set
; }
}
public
abstract
class
Bar
{
public
string
Title {
get
;
set
; }
public
double
Value {
get
;
set
; }
}
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Id}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FredBar.Title}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FredBar.Value}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FredBar.Date}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FredBar.Test}"
/>
</
telerik:RadGridView.Columns
>
The group panel item image of a column with custom header is blurred
If in the content of RadGridView.ControlPanelItem has a binding with a RelativeSource or ElementName and the grid is placed in the collapsed UserControl, a binding error is thrown in the output window.
We noticed that RadGridView does not get garbagecollected sometimes.
So i fired up a memory analyzer to see what is going on.
This is the graph that shows that the RadGridView is causing a leak. The only references that keep the GridView from getting collected are those two WeakEventListeners
To further investigate i decompiled GridViewDataControl and could identify the culprit.
private void SubscribeToDispatcherShutdown()
{
if (this.dispatcherShutdownListener != null)
this.dispatcherShutdownListener.Detach();
this.dispatcherShutdownListener = new WeakEventListener<GridViewDataControl, object, EventArgs>(this);
this.dispatcherShutdownListener.OnEventAction = (Action<GridViewDataControl, object, EventArgs>) ((grid, source, eventArgs) => grid.OnDispatcherShutdownFinished(source, eventArgs));
this.dispatcherShutdownListener.OnDetachAction = (Action<WeakEventListener<GridViewDataControl, object, EventArgs>>) (weakEventListener => this.Dispatcher.ShutdownFinished -= new EventHandler(this.dispatcherShutdownListener.OnEvent));
this.Dispatcher.ShutdownFinished += new EventHandler(this.dispatcherShutdownListener.OnEvent);
}
In the second line from the botton
... weakEventListener => this.Dispatcher.ShutdownFinished -
When TabStopMode is set to "Skip" on all columns and you press Tab, RadGridView scrolls a little. Workaround: define a custom KeyboardCommandProvider and clear the pending commands.
When a gridview is placed in TabControl, the following CodedUI tests will fail: Test 1. Click on a column header to sort by that column. Test 2. Click on a drop-down button to filter a column. Test 3. Drag a column to group by it.
Unhandled exception System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it. at System.Windows.Threading.Dispatcher.VerifyAccess() at System.Windows.DependencyObject.GetValue(DependencyProperty dp) at Telerik.Windows.Data.SortDescriptorBase.get_SortDirection() at Telerik.Windows.Data.Expressions.SortDescriptorCollectionExpressionBuilder.Sort() at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, IEnumerable`1 sortDescriptors) at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, SortDescriptorCollection sortDescriptors) . . .
The issue seems to be a bug with UI Row Virtualization since once I set it to False, it did not occur any more. You can also refer to the documentation on UI Virtualization: http://docs.telerik.com/devtools/wpf/controls/radgridview/features/ui-virtualization.html
workaround: public MainWindow() { InitializeComponent(); this.grid.Loaded += grid_Loaded; } void grid_Loaded(object sender, RoutedEventArgs e) { this.grid.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name == "PART_OuterGrid").RowDefinitions[1].Height = GridLength.Auto; var cells = this.grid.ChildrenOfType<GridViewHeaderCell>(); foreach (GridViewHeaderCell cell in cells) { cell.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name == "PART_OuterGrid").RowDefinitions[1].Height = GridLength.Auto; } }
As a temporary workaround, the following custom keyboard command provider can be used: public class CustomKeyboardCommandProvider : DefaultKeyboardCommandProvider { private GridViewDataControl parentGrid; public CustomKeyboardCommandProvider(GridViewDataControl grid) : base(grid) { this.parentGrid = grid; } public override IEnumerable<ICommand> ProvideCommandsForKey(Key key) { List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList(); if (key == Key.Enter) { commandsToExecute.Clear(); commandsToExecute.Add(RadGridViewCommands.CommitEdit); commandsToExecute.Add(RadGridViewCommands.BeginEdit); commandsToExecute.Add(RadGridViewCommands.MoveDown); } return commandsToExecute; } }
A possible workaround is to predefine the CellTemplate of the column as well.