Home > Silverlight > How to set ‘IsEnabled’ Property for Stackpanel in Silverlight

How to set ‘IsEnabled’ Property for Stackpanel in Silverlight


Its been long time, I have updated my blog. There are couple of reasons for not getting updated because of my work @ my new company. My new company as provided me an opportunity to work on technologies like silverlight and sharepoint.  I’m very thank ful for this. I wish my breadth of technology awareness and handon gets improved on day to day basis. Recently I came  across with problem of ” How to disable the stackpanel and its descedant controls”. By Default some container/layout control does not have “IsEnabled” property. To disable all controls inside the stackpanel, we need to add “IsEnabled” property for each control, which is not advisable and laborious one. We can perform another way by extending stackpanel/grid class with Custom Dependency Property of type “Boolean”.  Add new property to custom stackpanel /custom grid and disable all visualchildrens of childrens inside the layout control(stackpanel,grid).  i.e Stackpanel.Getvisualchildren() and disable each child control.

There is another simple way of disabling stackpanel/Grid/Dockpanel by adding “ContentControl” and wraps the stackpanel XAML code inside “ContentControl” .Since ContentControl is having “IsEnabled” property , we can Bind datacontext or set IsEnabled to false for disabling all controls inside the stackpanel. This is simplest for performing disabling of stackpanel/grid/dockpanel


Categories: Silverlight Tags: ,
  1. Venkata Bhupathiraju
    July 28, 2011 at 8:26 pm

    Thanks for nice tip

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: