This is a migrated thread and some comments may be shown as answers.

[Solved] Double tap/click on grid cell raises exception

3 Answers 170 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andreas
Top achievements
Rank 1
Andreas asked on 14 Aug 2013, 09:05 AM
Hi,

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)

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 


3 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 15 Aug 2013, 01:33 PM
Hello Andreas,

Thank you for using RadControls for Windows 8!

This issue was related to version 2013.2 716 of the controls and our developers have fixed it in the latest internal build (2013.2 806). Could you please update to the latest version and see if the problem still exists.
You can get the internal build using the Telerik Visual Studio Extensions or from this link when you are logged in on the site:
http://www.telerik.com/account/your-products/internal-builds.aspx

I look forward to your reply.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andreas
Top achievements
Rank 1
answered on 16 Aug 2013, 07:58 AM
Hi Rosita,

That sounds awesome! I'd love to try it.

But when trying to get to the latest build, I am experiencing the following problems:

When retrieving internal builds via http://www.telerik.com/account/your-products/internal-builds.aspx, I can only find internal builds for JustCode and JustTrace. When enabling internal builds via VSExtensions as you suggested, I still can only see 2013.2 716 as the latest build for Win8 Controls. 

Any suggestions how to fix that?

Thanks,
Andreas




0
Giuseppe
Telerik team
answered on 19 Aug 2013, 11:41 AM
Hello Andreas,

I checked our records and noticed that there are two Telerik accounts under the name of Andreas Myka -- the one that you used to post this message with registration email andreas@bitsofyours.com, and the other -- with email uidev1@bitsofyours.com. It seems the first account is not associated with the RadControls for Windows 8 purchase and that is why you cannot download the latest internal build from it.

You can either add your first account as a licensed developer to your purchase, or you can log in with your second account (uidev1@bitsofyours.com) and you should be able to see the latest internal build on the download page.

Hope this helps.


Regards,
Giuseppe
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Grid for XAML
Asked by
Andreas
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Andreas
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or