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

RaiseEvent

1 Answer 128 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brad Childs
Top achievements
Rank 1
Brad Childs asked on 03 May 2012, 01:06 AM
How do you raise the MouseLeftButtonDownEvent on a RadRibbonTab?

I have tried the following:

RadRibbonTab tmp;
tmp.RaiseEvent(new RadRoutedEventArgs(RadRibbonTab.MouseLeftButtonDownEvent));

however

RadRibbonTab.MouseLeftButtonDownEvent is of type System.Windows.RoutedEvent and RadRoutedEventArgs wants a Telerik.Windows.RoutedEvent.

I have also tried:

EventInfo eventInfo = typeof(RadRibbonTab).GetEvent("MouseLeftButtonDown");
var raiseMethod = eventInfo.GetRaiseMethod()
raiseMethod.Invoke(tmp, null);

however

raiseMethod is always null.

Is there some other way of clicking the tab programmatically?  Note, I do NOT want to use SelectedIndex or SelectedItem.  I want to simulate a mouse click.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Miro Miroslavov
Telerik team
answered on 07 May 2012, 11:43 AM
Hello Brad,

 Since the MouseLeftButtonEvent is the built-in silverlight mouse event, you can not raise outside of the framework element you're targeting. You may refer to this forum for more information. What I can suggest you is to use automation peers instead. So you can get the respective automation peer for the RadRibbonTab and force Selection through the peer which should behave exactly as it is clicked. 
Please let us know if this is what you need.

All the best,
Miro Miroslavov
the Telerik team

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

Tags
RibbonView and RibbonWindow
Asked by
Brad Childs
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Share this question
or