有可能在c#中列出所有的xaml图像标签吗?

本文关键字:xaml 图像 标签 有可能 | 更新日期: 2023-09-27 18:11:54

有没有办法在windows phone中获得c#中所有xaml标签(或任何其他标签)的列表而不给它们命名?

例如:

var list = this.GetElementsByTagName("Image");

有可能在c#中列出所有的xaml图像标签吗?

你可以这样做。

foreach(UIElement item in YourContainer.Children){
    MessageBox.Show(item.GetType().ToString());
}

它将返回类似于System.Window.Control.Image

的内容