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 workar开发者_JAVA百科ounds that will prevent the ScrollViewer acting as a tabstop when the scrollbars are invisible?
Thanks,
What about:
<ScrollViewer IsTabStop="False" ...
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);
}
精彩评论