Cancel Mouse click

Thread is closed for posting
3 posts, 0 answers
  1. guillaumeGL
    guillaumeGL avatar
    6 posts
    Member since:
    May 2009

    Posted 26 Nov 2009 Link to this post


    Is there a way to cancel user's click on tab ?
    In my situation, I need to only allow users to use F1-F12 keys to open the tabs, and I only want to show a MessageBox after a click.

    Disabling the tabs partially resolve this problem, but I completely lose the click/mouse-click events for the MessageBox.

    Best Regards,
    Guillaume Lebeau
  2. Martin Vasilev
    Martin Vasilev avatar
    1061 posts

    Posted 01 Dec 2009 Link to this post

    Hello Guillaume,

    Thank you for writing. RadTabStrip does not support escaping the mouse click event out of the box. However you can implement such a scenario by using TabSelecting and MouseDown events. Please, consider the following code-block:

    TabItem _previosTab;
    void radTabStrip1_MouseDown(object sender, MouseEventArgs e)
        TabItem clickedItem = this.radTabStrip1.ElementTree.GetElementAtPoint(e.Location) as TabItem;
        if (clickedItem != null && _previosTab != null)
            this.radTabStrip1.TabSelecting -= radTabStrip1_TabSelecting;
            this.radTabStrip1.SelectedTab = _previosTab;
            this.radTabStrip1.TabSelecting += radTabStrip1_TabSelecting;
            MessageBox.Show("Tab selecting was prevented!");
          _previosTab = null;
    void radTabStrip1_TabSelecting(object sender, TabCancelEventArgs args)
        _previosTab = this.radTabStrip1.SelectedTab as TabItem;

    Do not hesitate to contact me again if you have any other questions.

    Sincerely yours,
    Martin Vasilev
    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. guillaumeGL
    guillaumeGL avatar
    6 posts
    Member since:
    May 2009

    Posted 14 Dec 2009 Link to this post

    Thank you !!

    Your solution works great.
Back to Top