Quantcast
Channel: Dev Notes » .NET
Viewing all articles
Browse latest Browse all 5

Silverlight’s Missing ScrollViewer.ScrollChanged Event

$
0
0

If you’ve worked with Silverlight’s ScrollViewer you may have noticed the ScrollChanged event is missing. It exists in WPF but Microsoft conveniently left it out in Silverlight. If you need to be notified of changes to the VerticalOffset or HorizontalOffset you can use a dependency property which listens to the change of Offset properties of the ScrollViewer.

<ScrollViewer  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" x:Name="ScrollSource">
     <Grid x:Name="grdTimeline" />
</ScrollViewer>
<TextBox Text="{Binding HorizontalOffset, ElementName=ScrollSource}" x:Name="ScrollListener" />

Then you can use the TextChanged event of your textbox as the ScrollChanged event of the ScrollViewer.

Private Sub ScrollListener_TextChanged(sender As Object, e As System.Windows.Controls.TextChangedEventArgs) Handles ScrollListener.TextChanged
End Sub

Viewing all articles
Browse latest Browse all 5

Trending Articles