本文介绍了按名称查找控件的父级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在xaml代码中设置WPF控件的名称时,是否可以通过其名称找到父级?

Is there a way to find the parents of a WPF control by its name, when the name is set in the xaml code?

推荐答案

尝试一下,

element = VisualTreeHelper.GetParent(element) as UIElement;

在哪里,
元素是孩子-您需要得到谁的父母。

Where,element being the Children - Whose Parent you need to get.

这篇关于按名称查找控件的父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 10:04
查看更多