views:

49

answers:

2

Is there any way to disable all controls inside a container - grid for example? Thank you!

UPD: Although WPF’s Grid has IsEnabled property, there is definitely no IsEnabled property for Windows phone 7 Grid.

A: 

Just set

<Grid IsEnabled="False">
    <TextBox Width="100" Height="25"/>
</Grid>

And the TextBox will also be disabled.

Setting visual properties on a visual parent propagates to visual descendants. For example, setting opacity, the IsEnabled property, or setting a transform on the parent applies to the children as well.

See this link

Update

// Code behind
Grid grid = new Grid();
grid.IsEnabled = true;

Are you sure that it is a Grid that you are using?
Do you have any sample code?

Meleak
I haven't try this in xaml, but I couldn't set it from code-behind for Grid control. Code doesn't compile saying that there is no such property as IsEnabled :(.
Bashir Magomedov
Every FrameworkElement has a IsEnabled property.
Aurélien Ribon
They sure do :-) So I'm guessing Bashir Magomedov is trying to set IsEnabled on something else
Meleak
This is exactly what I thought, but I couldn't find it this morning. I thought it might be because of windows phone 7 restrictions. Ok, guys let me check it tonight, maybe I was too sleepy and did something wrong.
Bashir Magomedov
Yes, guys. I was right. There is definitely no IsEnabled for windows phone 7 Grid.
Bashir Magomedov