Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Overriding IsEnabled
3 replies. Latest Post by hwsoderlund on April 8, 2009.
(0)
hwsoderlund
Member
411 points
118 Posts
04-08-2009 7:16 AM |
I would like to set IsEnabled to false for a particular usercontrol, and have that setting automatically be inherited by all children of that control. But then I would like to override that value for some of the children. See the example below. I want the first button to be enabled, and the rest to inherit the setting on the parent user control (IsEnabled=false). But all the children are disabled no matter what I do. Is there a way of accomplishing this? It seems logical to me that the setting on a child should override the setting on the parent.
<UserControl x:Class="SilverlightApplication3.MyUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:SilverlightApplication3" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300" IsEnabled="False"> <Grid x:Name="LayoutRoot" Background="White"> <StackPanel> <Button Content="Btn1" IsEnabled="True"></Button> <Button Content="Btn2"></Button> <Button Content="Btn3"></Button> </StackPanel> </Grid></UserControl>
.netdan
Contributor
3412 points
513 Posts
04-08-2009 7:25 AM |
I agree, however that is the way it works in Silverlight 2 at the moment, maybe the final version of SL3 will support this. Perhaps you would like to post this on this Silverlight 3 wishlist post.
Tim Dawson
Participant
1140 points
218 Posts
04-08-2009 7:35 AM |
This is the way it has always worked in Windows and there is very little chance of Microsoft adding this kind of functionality in a future release of Silverlight or even WPF.
04-08-2009 7:49 AM |
Well, I've posted it on the wishlist for SL3 now, so we'll see what happens.