在C#WPF中获取用户控制窗口主机 [英] Getting user control window host in C# WPF

查看:161
本文介绍了在C#WPF中获取用户控制窗口主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个重复多次的问题:

我正在WPF中使用Windows,正在创建用户控件的窗口中,如何从用户控件的父"(托管他的窗口)中获取信息?
我主要在事件中需要它,我知道有一种触发方法,但是我正在寻找一种简单的方法.

有人可以帮我吗?

谢谢

Hi,

I have a question which repeats itself a number of times:

I am using windows in WPF , in the windows I am creating user controls, how do i get from the user control its "parent"(the window which is hosting him)?
I mainly need it for events, I understood there is a way doing it with firing, but i am looking 4 a simple way.

can anyone help me?

Thanks

推荐答案

所有窗口都具有Parent和Owner属性.我相信父母是你想要的那个.控件就是窗口.
All windows have a Parent and an Owner property. I believe Parent is the one you want. A Control is a Window.


此处 [< ^ ].这将为您提供所需的功能.
Have a look at Sacha Barber''s post here[^]. This will give you exactly what you need to do.


这篇关于在C#WPF中获取用户控制窗口主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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