Note that there are some explanatory texts on larger screens.

plurals
  1. POIt is possible to create "new MouseButtonEventArgs" in Silverlight?
    primarykey
    data
    text
    <p>I'm newbie in Silverlight and I need to activate <code>MouseRightButtonDown(object sender, MouseButtonEventArgs e)</code> from an another event handler in my application. </p> <p>I have found, that in WPF it is possible to do somthing like this:</p> <pre><code>public void OnContextMenuOpened(object sender, RoutedEventArgs e) { MouseButtonEventArgs args = new MouseButtonEventArgs( InputManager.Current.PrimaryMouseDevice, 0, MouseButton.Right); MouseRightButtonDown(sender, args); } </code></pre> <p>But I have in Silverlight neither InputManager-Class nor MouseButton-Class... It is generally possible to realise something like that?</p> <p>I want to do it, because I try to select an DataGridRow(within an custom control) with help of right-mouse-button. Without context menu it is easily possible, but when I switch context menu on, then context menu opens and event will not fired...</p> <p>My code snippet:</p> <pre><code>public override void OnApplyTemplate() { DataGrid = (DataGrid)GetTemplateChild("DataGrid"); DataGrid.MouseRightButtonDown += DataGridMouseRightButtonDown; ContextMenu = (ContextMenu)GetTemplateChild("ContextMenu"); ContextMenu.Opened += OnContextMenuOpened; } private void DataGridMouseRightButtonDown(object sender, MouseButtonEventArgs e) { //My code to select an DataGridRow } public void OnContextMenuOpened(object sender, RoutedEventArgs e) { //This event-handler now will be always activated if I do //right-mouse-button-click } </code></pre> <p>Thanks a lot for help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload