如何找到一个用户控件组件在WPF的所有控件 [英] How to find all the controls in WPF on a UserControl component

查看:75
本文介绍了如何找到一个用户控件组件在WPF的所有控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以得到所有UI控件的表格但如何找到某个控件用户控件

I can get all UI controls on a Form but how to find controls on a certain UserControl?

推荐答案

您可以使用 LINQ的运营商OfType 控制财产

var controls = YourForm
               .YourUserControl
               .Controls.OfType<TextBox>();
foreach(var control in controls)
{
    ....
}

链接: http://msdn.microsoft.com/fr- FR /库/ vstudio / bb360913.aspx

这篇关于如何找到一个用户控件组件在WPF的所有控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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