I am new to data binding but it sounds like that's what I want in this case (started with event hooks but it turned out to be a hassle trying to avoid the Infinite Loop). I have a Slider in my XAML that I want to start at initial value 0. I then have a MediaElement where I use MediaElement.Position to get how far the song has played, and CurrentSong.Length to get the total length of the song. Both MediaElement.Position and CurrentSong.Length return TimeSpans. When I tried the event hook thingy I did a little algebra using TotalSeconds on both of these to get a value between 0.0 and 10.0 for the Slider.
I got into problems trying to hook up to the event Slider.ValueChanged since this is called when I update the slider I get into an Infinite Loop (TM). All I want is to be able to change MediaElement.Position using the Slider, and make the Slider follow MediaElement.Position as the song is played.
Is this a good place to use data binding? I think so. Problem is that the two values are not really compatible. I cannot just take the value from one object and send it over to the other object. Since MediaElement.Position is relative to the length of the currently playing song I need to do some calculations using CurrentSong.Length in order to "translate" between the two objects. How do I accomplish thi
View Complete Post