Is it possible to disable a ScrollViewer from inside the ScrollViewer?

Posted by gehho on Stack Overflow See other posts from Stack Overflow or by gehho
Published on 2010-06-01T13:11:16Z Indexed on 2010/06/01 13:13 UTC
Read the original article Hit count: 433

Filed under:
|

From a UserControl, I would like to disable a ScrollViewer which is defined one level higher. My scenario looks something like this:

<!-- ... -->
<ScrollViewer VerticalScrollBarVisibility="Auto"
              HorizontalScrollBarVisibility="Disabled">
    <custom:MyUserControl ... />
</ScrollViewer>

Now, I would like to disable the ScrollViewer from within MyUserControl. Is this possible?

Background:
I have defined a custom TabControl style where I added a ScrollViewer for each item's content automatically. However, in one case, I do not want to use that ScrollViewer, but rather make the content size to the available space, whereas in all other cases I do want to use the ScrollViewer. Any ideas? Of course, I could add a ScrollViewer to every tab item manually, except for the one item, but that is not what I want.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about scrollviewer