you might say it's a duplicate of How to stop update value of slider while dragging it? but honestly the solution there is from 2011 and just not working for me (as even commented on the accepted answer by other users), and the other answers aren't relevant for me. So please be patient guys.
That's my problem: I have a slider that is binded to a value like that:
<Slider Name="AudioSlider" Value="{Binding AudioValue}"
Grid.Column="1" Grid.Row="1" Height="30"
SmallChange="1" Maximum="100"
IsSnapToTickEnabled="True"
IsMoveToPointEnabled="True"/>
And this is the value:
private double _audioValue;
public double AudioValue
{
get { return _audioValue; }
set
{
if (_audioValue == value)
return;
_audioValue = value;
SendPacket(cockpitType, (byte)Index.AudioSlider, (byte)_audioValue);
OnPropertyChanged("AudioValue");
}
}
As you can see, every time the value changes I am sending a packet, when it updates the value on drag it's just spamming the value on the server and it's something that must be prevented.
I have tried to bind the slider to a function (mouseUp) but I couldn't get the value this way.
Any ideas what I can do?
Thanks a lot.
Edit:
The answer here WPF: Slider with an event that triggers after a user drags doesn't help me since it's a generated slider inside a data template, events aren't relevant for me.