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

DataBoundListBox and Contextmenu Tap & Hold

4 Answers 108 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernhard König
Top achievements
Rank 2
Bernhard König asked on 09 Aug 2011, 11:33 PM
Hello,

during tests with the current build of my app I noticed a problem when using a context menu (from the Silverlight Toolkit for WP) - when the user taps & holds an item to bring up the context menu, this also changes the current selected item in the list.

Now I'm not sure if it's really wrong that this happens but it would be good to have a possibility to prevent this behaviour as I think many apps react on selection changes in lists to start a navigation to a details page (or something like that).

So a wish for the next release: please make it possible to have the DataBoundListBox only change it's selected item when the user makes a single tap, and not on a tap & hold.

In the meantime i just listen to the open & closed events of the Context Menu so I always know when a context menu is open ... and in this case prevent changig the selected item.

Btw, did I already mention that I'd really like to see a better performing, rockin' fluid context menu in your WP7 controls to replace the Silverlight Toolkit one? (hint, hint) :)

Thanks,
Bernhard


4 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 11 Aug 2011, 09:46 AM
Hi Bernhard,

Thanks for writing and for your feedback.

Indeed, the behavior that you describe is not correct. I have checked this behavior with the standard ListBox control and it seems that there is a certain time interval which, when passes, the ManipulationCompleted event that comes is not considered a tap event and thus the item in question is not selected.

We will consider this and will make sure to sync RadDataBoundListBox to behave in pretty much the same way.

As for implementing our own context menu - we have not discussed this yet and I cannot give any exact information on whether we are going to implement such component or not.

I have updated your account with 500 Telerik points for your feedback on the ItemTap logic in RadDataBoundListBox.

I hope this is helpful.

Do not hesitate to get back to us in case you have further questions or need assistance.

Greetings,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Bernhard König
Top achievements
Rank 2
answered on 11 Aug 2011, 01:14 PM
Thanks Deyan!

cheers,
b.
0
Garry
Top achievements
Rank 1
answered on 12 Aug 2011, 04:10 AM
So I'm having the same issue (was waiting for the response), but I dont see a work around for this behaviour. How can we prevent the click event firing so we dont trigger the navigation?
Thanks
0
Bernhard König
Top achievements
Rank 2
answered on 12 Aug 2011, 10:33 AM
Hi Garry,

you can't prevent the event from firing but rather write some code to work around it.

I don't know if you're using MVVM for your project, but what I have done is:

 

  • Added a new boolean property "IsAnyContextMenuOpen" to my ViewModel
  • Added an event handler to Context Menu's Opened and Closed events in the code behind of my View
  • I keep a reference to my ViewModel in my View's code behind so I set the ViewModel.IsAnyContextMenuOpen property to true when the Opened event was raised and to false when the Closed event was raised.
  • In my ViewModel property that holds the selected item of the listbox ("ListboxSelectedItem" or something) i add code to the Setter that prevents setting a new value for this property as long as IsAnyContextMenuOpen is true.

If you're not using MVVM it would be even easier, just keep a field or property that holds the boolean value in your code behind and prevent executing any code that should not run while this flag is true.

That's not beautiful, but it works until we get a fix ...

hth,
Bernhard

Tags
DataBoundListBox
Asked by
Bernhard König
Top achievements
Rank 2
Answers by
Deyan
Telerik team
Bernhard König
Top achievements
Rank 2
Garry
Top achievements
Rank 1
Share this question
or