Silverlight:FrameworkElement.FindName() 在控件不“可见"时找不到它在浏览器窗口中 [英] Silverlight: FrameworkElement.FindName() not finding the control when it's not "visible" in the browser window

查看:29
本文介绍了Silverlight:FrameworkElement.FindName() 在控件不“可见"时找不到它在浏览器窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,我使用 FrameworkElement 对象的FindName()"方法来搜索该元素的子控件.

I'm having an issue where by I'm using the "FindName()" method of the FrameworkElement object to search for a child control of that element.

我注意到了一些有趣的行为,但似乎无法弄清楚.如果用户滚动浏览器窗口以便控件本身不再在窗口框架的上下文中可见,则FindName()"不会返回该元素.但是,如果该控件在窗口框架内可见,它就会发现它很好.

There's some interesting behavior that I've noticed and can't seem to figure out. If the user scrolls the browser window so that the control itself visibly is not shown anymore within the context of the window frame, then the "FindName()" does not return the element. However, if that control is visible within the window frame, it finds it fine.

这是一个已知问题吗?有没有其他人遇到过这种情况?

Is this a known issue? Has anyone else run into this before?

我也不是在谈论控件的 Visibility 属性.可见性属性设置为可见.

I'm not talking about the Visibility property of the control either. The Visibility property is set to Visible.

更新我试图在 ListBox 控件(我正在搜索的容器)上设置 VirtualizingStackPanel.VirtualizationMode="Standard",但它仍然没有找到指定的控件.

Update I attempted to set VirtualizingStackPanel.VirtualizationMode="Standard" on the ListBox control (which is the container I'm searching) and it still did not find the control specified.

推荐答案

如果您使用诸如 Silverlight Spy 您可以尝试手动找到控件.

If you use a tool such a Silverlight Spy you can try and find the control by hand.

如果它不存在,它可能在一个虚拟化堆栈面板中.

If it is not there it is probably in a virtualizing stackpanel.

这篇关于Silverlight:FrameworkElement.FindName() 在控件不“可见"时找不到它在浏览器窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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