22. October 2010 03:40
Today I had a problem where the ScrollViewer in my user control would not scroll using the mouse wheel unless it was over a control like a textbox or label... anything other than the grid that is LayoutRoot. It went something like this:
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Padding="1" BorderThickness="0" >
<Grid x:Name="LayoutRoot" >
After much trial and error, I figured out that all is needed is a background... it can even be set to Transparent. So, I did this:
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Padding="1" BorderThickness="0" >
<Border Background="Transparent">
<Grid x:Name="LayoutRoot" >
I know it is simple and probably makes me look like igmo, but I thought it might help somebody else one day. :)
ae745a4b-31a6-411f-a9d7-730c5fac02ae|0|.0