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 ???

>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'

Just add the cast explicitly:

MouseEventArgs ee = (MouseEventArgs)e;

yep, I tried casting too and I get:

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

Try this:

System.Windows.Input.MouseEventArgs ee = (System.Windows.Input.MouseEventArgs)e;