Reputation: 2174
I have one child window in Silverlight 3.0 Application. In that application I have one Slider. Whenever I am sliding the slider, The Slider_ValueChanged event gets fire more than 30 times in a second. I want to control the number of events fired? I am using Slider like this:
<Slider Grid.Row="3" Height="17" HorizontalAlignment="Left" Margin="188,0,0,20" ValueChanged="sliderValueChanged" MouseLeftButtonUp="Slider_MouseLeftButtonUp" Name="Slider" VerticalAlignment="Top" Visibility="Collapsed" Width="456" Orientation="Horizontal" Background="Black" SmallChange="5" LargeChange="5" />
The event sliderValueChanged takes a little time to execute. So I just want to reduce the number of calls to that event.
EDIT: Actually my problem is in child window i am drawing multiple wave forms.Without loading the waveform, the slider works fine(Empty Screen) But when ever i am loading the wave form on screen then it does not work finely.(Instead of showing continuous smooth movement it jumps.)I am not getting what problem is actually?And how to overcome it?
Upvotes: 0
Views: 799
Reputation: 93551
Get your sliderValueChanged
event to save the current (latest) scroll value and use a Timer to check for changes to that number on a regular basis (say 30 frame per second or 60 frames per second).
The default in Silverlight is 60 frames per second but can be altered. The closer your updates are to the refresh rate, the smooth it will appear.
Upvotes: 1