Silverlight ScrollViewer takes focus when scrollbars are not visible

I'm finding that Silverlight's ScrollViewer will still take focus even when the scrollbars are not visible.

Has anyone else seen this issue? Are there any workarounds that will prevent the ScrollViewer acting as a tabstop when the scrollbars are invisible?

Thanks,

Upvotes: 0

Views: 935

Answers (2)

Jamie
Jamie

Reputation: 11

There is a simple solution, at least in Silverilght 4 and up. Listen to the LayoutUpdated event on the ScrollViewer and set the IsTabStop property based on the status of the scrollbars.

For example, if you only are using a vertical scroll bar:

void myScrollViewer_LayoutUpdated(object sender, EventArgs e)
{
    //this should only be a tabstop if the scrollbar is visible.
    myScrollViewer.IsTabStop = 
       (myScrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible);
}

Upvotes: 1

Kent Boogaart
Kent Boogaart

Reputation: 178630

What about:

<ScrollViewer IsTabStop="False" ...

Upvotes: 1

Related Questions