Skip to main content

Microsoft Silverlight

Answered Question Overriding IsEnabledRSS Feed

(0)

hwsoderlund
hwsoderlund

Member

Member

411 points

118 Posts

Overriding IsEnabled

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
.netdan

Contributor

Contributor

3412 points

513 Posts

Answered Question

Re: Overriding IsEnabled

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.

Remember to click "Answer" if this has helped you!

Dan Birch
MCSD, MCAD, MCP
Free Silverlight Controls | Free .NET Silverlight CMS

Tim Dawson
Tim Dawson

Participant

Participant

1140 points

218 Posts

Re: Overriding IsEnabled

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.


Microsoft MVP
Controls for Silverlight, WPF and Windows Forms at http://www.divelements.co.uk

hwsoderlund
hwsoderlund

Member

Member

411 points

118 Posts

Re: Overriding IsEnabled

Well, I've posted it on the wishlist for SL3 now, so we'll see what happens.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities