Display a context menu after timeout

2 posts, 0 answers
  1. Ciaran
    Ciaran avatar
    10 posts
    Member since:
    Nov 2007

    Posted 10 Sep 2009 Link to this post

    I'd like to create a "LongClick" type behavior where a context menu displays after a short delay... is that possible with the RadContextMenu? I don't see a listing of the strings of the EventNames that you can use to display the menu in the documentation anywhere.

    I thought I could set or bind the IsOpen property of the menu... My idea was that I'd bind it to a property that would change after the delay elapsed. But setting the property to "True" causes a crash AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 37 Position: 54]

    Button Content="Menu" Visibility="{Binding MenuButtonVisibility}">








    <telerikNavigation:RadContextMenu IsOpen="True" >




    <telerikNavigation:RadMenuItem Header="Edit..." />




    <telerikNavigation:RadMenuItem Header="Add..." />




    <telerikNavigation:RadMenuItem IsSeparator="True"/>




    <telerikNavigation:RadMenuItem Header="Cut" />




    <telerikNavigation:RadMenuItem Header="Paste" />




    <telerikNavigation:RadMenuItem IsSeparator="True"/>




    <telerikNavigation:RadMenuItem Header="Delete"



    cal:Click.Command="{Binding DeleteItemCommand}"



    cal:Click.CommandParameter="{Binding Location}"/>














    and binding it to a value in my ViewModel does nothing at all.

  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 16 Sep 2009 Link to this post

    Hello Ciaran,

    RadContextMenu does not support setting IsOpen in XAML, hence the AG_E_PARSER_BAD_PROPERTY_VALUE exception. You should set it in an event handler, that is executed after Loaded, for example Button.Click. There is no list with the supported events for RadContextMenu because it will try to attach to any CLR event with the provided name if such is present. The only exception is the right-click event which is non-standard routed event, implemented by us.

    Please, find attached a simple example that demonstrates how to open a context menu if the mouse button was hold more than 500ms. I didn't manage to make it entirely in the view model, but I suppose the idea is clear. Let me know if you need additional information.

    All the best,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top