silverlight - Silverlight 的 DataTemplate 中缺少 FindName 方法是否有解决方法?

标签 silverlight datatemplate findname

根据 C# 编译器和 Silverlight 2 文档,Silverlight 没有为 DataTemplate 类提供 FindName 方法。我想找到一个位于 ContentPresenter 内的边框。 SilverLight 2 中的最佳方式是什么?

最佳答案

如果边框在 DataTemplate 内,而不是在 ControlTemplate 内,那么我过去能够做到这一点的唯一方法是使用 VisualTreeHelper 来定位我需要的元素。

关于silverlight - Silverlight 的 DataTemplate 中缺少 FindName 方法是否有解决方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/288115/

相关文章:

silverlight - Silverlight 应用程序中的文化

silverlight - Silverlight中使用嵌入式资源(四)——其他文化不编译

c# - WPF Template.FindName 总是返回 null

c# - 在 WP7 的 silverlight 中删除图像源

silverlight - 如何使用 EF4 映射存储过程?

wpf - 在 WPF 中访问 DataTemplate 中的项目

wpf - 绑定(bind)到 WPF 中 TabControl 的 ItemsSource

c# - ScrollViewer 忽略 ContentTemplateSelector

wpf - 在 TreeView 中查找 ItemTemplate 控件

c# - 如何查找 UserControl 的子项而不是 Window - 替换 Window.FindName