Click here to Skip to main content
16,004,574 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i am creating winforms user control which has a button control event,That User control is used in MY WPF project. And problem is i am not getting how to raise button click event from my WPF application which will raise Winforms user control button click event

What I have tried:

Trying to raise winforms user control button click event from wpf button
Posted
Updated 7-Sep-16 5:11am
Comments
[no name] 7-Sep-16 8:15am    
"Trying to raise winforms user control button click event from wpf button", doesn't complile for me. It does not appear to be C# code. Do you think that you are having trouble because you are doing something completely unnecessary and weird? Not to mention, doesn't make any sense.
David_Wimbley 7-Sep-16 11:03am    
This doesn't make sense and i think you need to re-evaluate what it is you are trying to do. Seems like making a square peg fit through a round hole.

1 solution

As I understood your requirement you want that for example the Click-Event, which is raised by the Button on the UserControl, should come from the UserControl. The Button on the UserControl should not be known outside the Control.

If this is right you only need to catch the Button.Click inside the UserControl (with a short method) and with this method you call the (protected) OnClick-Method from the UserControl.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900