views:

8

answers:

2

I have lots of nested controls in the panel and I want to disable all of them, but leave scrolls enabled. Basically, I'm setting IsEnabled property of the root element (panel) to false using binding. But this disables scroll as well. Any ideas (except adding IsEnabled to each control instead)? I'm using MVVM.

So, in code it looks like this:

<Grid IsEnabled="{Binding IsControlEnabled}"> 
  <StackPanel>
    <.../>
    <CustomControl/>
    <.../>
  </StackPanel>
</Grid>

CustomControl is also complex control and it has, for example, <ListBox> in a <Scrollviewer>. And my point is to give user a possibility to scroll items in ListBox, when IsControlEnabled == false.

A: 

If you are disabling the parent control containing the controls which each have a scrollviewer this is your issue. You need to disable per control and not alter the parent container control.

SEE EXAMPLE:

 <Grid x:Name="LayoutRoot"
      Background="White">
    <ScrollViewer Height="50">
        <Button IsEnabled="False"
                Height="100" />

    </ScrollViewer>
</Grid>

Blessings,

Jeff

Jeff Gwaltney
He said "except adding IsEnabled to each control instead"
Eduardo Molteni
A: 

You can add a ScrollBar outside the parent Control and synchronize both scrollbars. Check out this project for automatic Scroll Synchronization

alt text

Eduardo Molteni