Hi there,

I have a WinForm application written in C#. I have added a WPF usercontrol added to the Winform and I want to get the mouse Events passed back to the WinForm.

So you can see in line 6, my XAML I have a MouseUp event:

UserControl x:Class="CustomRssFeed.MainWin"
Height="41" Width="699" Foreground="#FFFFFFFF" Loaded="MainWin_Loaded" Unloaded="MainWin_Unloaded"

and I have a XAML.CS with:

private void UserControl_MouseUp(object sender, MouseButtonEventArgs e)

My question is how do I convert the 'MouseButtonEventArgs e' to a friendly WinForm version of MouseEventArgs ???

Edited 7 Years Ago by EcklerPa2: Added [code] tags. Encase your code in: [code] and [/code] tags.

>how do I convert the 'MouseButtonEventArgs....?
Class MouseButtonEventArgs is a subclass of MouseEventArgs.

private void UserControl_MouseUp(object sender, MouseButtonEventArgs e)
   MouseEventArgs ee=e;  //Boxing

Thanks for the reply but I still get the compile error:

Cannot implicitly convert type 'System.Windows.Input.MouseButtonEventArgs' to 'System.Windows.Forms.MouseEventArgs'

yep, I tried casting too and I get:

Cannot convert type 'System.Windows.Input.MouseButtonEventArgs' to 'System.Windows.Forms.MouseEventArgs'

This article has been dead for over six months. Start a new discussion instead.