从wpf的窗口中获取用户控件单击 [英] get usercontrol clicked from window in wpf
本文介绍了从wpf的窗口中获取用户控件单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在wpf的学生录入系统中有一个需求,即我有一个用户控件,在wpf中有两个按钮.我现在在窗口中加载该用户控件,我希望从该窗口中的用户控件中单击哪个按钮,然后根据单击的按钮,我想调用另一个用户控件并将其嵌入到窗口中.
请帮我做..
谢谢与问候,
我认为您应该尝试在事件中使用
object sender
参数.您可以使用
Button btn = (Button)sender; btn.Name
以获得发件人的姓名.
Hello everyone,
I have one need in my student entry system which is in wpf, that i have one user control there are two buttons in wpf.. i load that user control in window now i want that which button is clicked from the usercontrol from that window and according to the button clicked i want to call another user control and embed that into window.
Please help me in making this..
Thanks & Regards,
krunal Panchal
解决方案
I think taht you should try to useobject senderargument in event. You can use
Button btn = (Button)sender; btn.Name
to get name of sender.
这篇关于从wpf的窗口中获取用户控件单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文