I want to create a tilemap based game in c#. (I know that mvvm and c# might not be the best approach for games but it's a requirement for my class).
I want to have an ObservableCollection of Tiles (a class that I made already which is holding x and y positions as well as the path to the image itself). Now I want my Map-Canvas in my xaml file to be bound to that ObservableCollection, displaying an Image on that Canvas for every single Tile (using the x, y and image-path attributes of that object), so that when I add or delete another Tile the Canvas automatically updates. I've been searching for a solution for a quite a bit and I've stumbled across DataTemplates several times, but I couldn't find any example of using Images like that on a Canvas. (Canvas gives me the best flexibility for the rest of the project ,I rather not want to use a GridPane unless it's totally necessary)
Could you give me a small example of how this might work in MVVM? Thanks in advance.