I'm currently making a visual (WPF) representation for the chess engine I wrote. For reference, I used this thread (Mark Feldman's answer) to create the chess board and the chess pieces. Only difference is, that I didn't use the MVVM Light package and instead just used regular MVVM pattern.
Now, as I said, I wrote a chess engine. Whenever I click on a button a random legal move from my engine gets chosen and the pieces on the board get moved around accordingly. This happens by setting the "Pos" property of the instance of the ChessPiece class and due to the INotifyPropertyChanged this gets propagated to the view. But the pieces don't 'move' (obviously), but rather teleport to their destination.
And this is, where I'm stuck right now:
- I can't define the animation in Xaml code, because the destination is not hard coded, but depends on the move made
- I also can't define an animation via C# code, because all the images are in the ItemsSource of the ItemsControl and I can't get a reference of the image object. Otherwise I could use this example to create the animation on the fly.
If possible, I'd like to setup the animation via Xaml code to maintain the "data driven"-ness. But if that's not possible, then I'd take the second option.
If you need any further information/details/code, just say it, I'll update the question.
Thank you in advance! Julius