This question is locked. New answers and comments are not allowed.
Hi,
I have a rather straightforward RadDataGrid which binds the SelectedItem to a property of the ViewModel and thus handles single taps/clicks nicely:
However, if I don't handle double taps / clicks explicitly via binding to a command (that doesn't do anything) like
the app crashes when a cell gets double tapped:
Even inserting into the RadDataGrid an (empty) event handler for the DoubleTapped event doesn't seem to help. The only thing that appears to help is binding to a command that doesn't do anything:
Long story short: Is that a bug or a feature? ;-) And: is binding to an (empty) command the best solution here - or are there any better?
Thanks,
Andreas
I have a rather straightforward RadDataGrid which binds the SelectedItem to a property of the ViewModel and thus handles single taps/clicks nicely:
<Grid:RadDataGrid x:Name="MyDataGrid" UserEditMode="Inline" SelectedItem="{Binding SelectedCard, Mode=TwoWay}" UserGroupMode="Disabled" AutoGenerateColumns="False" ItemsSource="{Binding ActiveCollection.Cards}" GroupHeaderDisplayMode="Scrollable">However, if I don't handle double taps / clicks explicitly via binding to a command (that doesn't do anything) like
<Grid:RadDataGrid.Commands> <viemodels:ActiveCollectionCellDoubleTapped/></Grid:RadDataGrid.Commands>the app crashes when a cell gets double tapped:
System.ArgumentException
at Telerik.UI.Xaml.Controls.Input.RangeControlBase.OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at Windows.UI.Xaml.FrameworkElement.SetBinding(DependencyProperty dp, BindingBase binding)
at Telerik.UI.Xaml.Controls.Grid.DataGridNumericalColumn.PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
at Telerik.UI.Xaml.Controls.Grid.DataGridTypedColumn.PrepareEditorContainer(GridCellEditorModel editor)
at Telerik.UI.Xaml.Controls.Grid.XamlGridEditCellGenerator.PrepareContainerForItem(GridCellEditorModel decorator)
at Telerik.UI.Xaml.Controls.Grid.CellEditorModelGenerator.PrepareContainerForItem(GridCellEditorModel decorator)
at Telerik.UI.Xaml.Controls.Grid.CellsController`1.GetCellDecorator(IItemInfoNode parentRow, ItemInfo columnItemInfo, Int32 rowLine, Int32 columnLine)
at Telerik.UI.Xaml.Controls.Grid.CellsController`1.GenerateCellsForRow(IItemInfoNode rowDecorator, Int32 rowSlot)
at Telerik.UI.Xaml.Controls.Grid.GridModel.GenerateCellsForEditRow(Int32 rowSlot, Double largestRowElementWidth, IItemInfoNode rowDecorator)
at Telerik.UI.Xaml.Controls.Grid.GridModel.Telerik.UI.Xaml.Controls.Grid.ITable.GenerateCellsForRow(Int32 rowSlot, Double largestRowElementHeight, IItemInfoNode rowDecorator)
at Telerik.UI.Xaml.Controls.Grid.EditRowPool.UpdateEditRow(ItemInfo info, RadPoint startPosition)
at Telerik.UI.Xaml.Controls.Grid.GridModel.UpdateEditRow()
at Telerik.UI.Xaml.Controls.Grid.GridModel.MeasureCells(RadSize newAvailableSize)
at Telerik.UI.Xaml.Controls.Grid.RadDataGrid.OnCellsPanelMeasure(RadSize newAvailableSize)
at Telerik.UI.Xaml.Controls.Grid.Primitives.DataGridCellsPanel.MeasureOverride(Size availableSize)
at Telerik.UI.Xaml.Controls.Grid.DataGridNumericalColumn.PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
at Telerik.UI.Xaml.Controls.Grid.DataGridTypedColumn.PrepareEditorContainer(GridCellEditorModel editor)
at Telerik.UI.Xaml.Controls.Grid.XamlGridEditCellGenerator.PrepareContainerForItem(GridCellEditorModel decorator)
at Telerik.UI.Xaml.Controls.Grid.CellEditorModelGenerator.PrepareContainerForItem(GridCellEditorModel decorator)
at Telerik.UI.Xaml.Controls.Grid.CellsController`1.GetCellDecorator(IItemInfoNode parentRow, ItemInfo columnItemInfo, Int32 rowLine, Int32 columnLine)
at Telerik.UI.Xaml.Controls.Grid.CellsController`1.GenerateCellsForRow(IItemInfoNode rowDecorator, Int32 rowSlot)
at Telerik.UI.Xaml.Controls.Grid.GridModel.GenerateCellsForEditRow(Int32 rowSlot, Double largestRowElementWidth, IItemInfoNode rowDecorator)
at Telerik.UI.Xaml.Controls.Grid.GridModel.Telerik.UI.Xaml.Controls.Grid.ITable.GenerateCellsForRow(Int32 rowSlot, Double largestRowElementHeight, IItemInfoNode rowDecorator)
at Telerik.UI.Xaml.Controls.Grid.EditRowPool.UpdateEditRow(ItemInfo info, RadPoint startPosition)
at Telerik.UI.Xaml.Controls.Grid.GridModel.UpdateEditRow()
at Telerik.UI.Xaml.Controls.Grid.GridModel.MeasureCells(RadSize newAvailableSize)
at Telerik.UI.Xaml.Controls.Grid.RadDataGrid.OnCellsPanelMeasure(RadSize newAvailableSize)
at Telerik.UI.Xaml.Controls.Grid.Primitives.DataGridCellsPanel.MeasureOverride(Size availableSize)
Even inserting into the RadDataGrid an (empty) event handler for the DoubleTapped event doesn't seem to help. The only thing that appears to help is binding to a command that doesn't do anything:
public class ActiveCollectionCellDoubleTapped : DataGridCommand { public ActiveCollectionCellDoubleTapped() { this.Id = CommandId.CellDoubleTap; } public override bool CanExecute(object parameter) { var context = parameter as DataGridCellInfo; // put your custom logic here return true; } public override void Execute(object parameter) { var context = parameter as DataGridCellInfo; // put your custom logic here } }Long story short: Is that a bug or a feature? ;-) And: is binding to an (empty) command the best solution here - or are there any better?
Thanks,
Andreas