问题描述
有没有办法禁用容器内的所有控件 - 例如网格?谢谢!
Is there any way to disable all controls inside a container - grid for example?Thank you!
UPD:虽然 Silverlight 的 Grid 有 IsEnabled 属性,但 Windows phone 7 Grid 肯定没有 IsEnabled 属性.
UPD: Although Silverlight’s Grid has IsEnabled property, there is definitely no IsEnabled property for Windows phone 7 Grid.
推荐答案
在尝试禁用 Grid 内的所有子控件几天后,我发现以下内容:
After several days of trying to disable all child controls inside Grid, I found following:
- WP7 网格没有 IsEnabled 属性
- 我们仍然可以遍历所有子控件并设置它们的 IsEnabled 属性
- 我们还可以使用网格的 Visibility 属性
确实,如果控件被禁用,显示控件没有多大意义,甚至可以节省一些空间,并在我们根据用户输入隐藏和显示它时增加一些交互性.
Indeed, it doesn't make much sense showing controls if they are disabled, and it even saves some space and adds some interactivity when we hide and show it according to users' input.
我同意这不是很有说服力的答案,但它是我迄今为止唯一的答案.:)
I agree that this is not very convincing answer, but it is the only one that I have so far. :)
这篇关于为容器启用了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!