我需要从用户控件调用主页事件的解决方案 [英] I need solution to call Main Page events from usercontrol

查看:54
本文介绍了我需要从用户控件调用主页事件的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解决方案以从wpf浏览器应用程序中的usercontrol调用主页事件.

I need solution to call Main Page events from usercontrol in wpf browser application

推荐答案

我认为您的思考过程在这里有些偏离. UserControl本身不应该知道其父级.这就是拥有用户控件的重点.如果需要根据用户控件上发生的某些操作在父级上执行某些操作,则用户控件应引发父级可以捕获的事件.这样,用户控件便与父控件保持分离,但可以与其进行通信.
I think your thought process is a little off here. The UserControl itself should not know about its parent. That is the whole point to have user controls. If something needs to execute on the parent based on some action occuring on the user control, then the user control should raise an event that the parent can capture. That way the user control remains separated from its parent, but can communicate with it.


这篇关于我需要从用户控件调用主页事件的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆