I am trying to make a monopoly game using the WPF, Prism and MVVM. On my View I have a grid divided into several rows and columns. Each cell is a separate game card, for example, a city.
I also have a content controls which displays my players as chips.
The task is to move my players, relative to the cells in the grid. And I need to do this from my ViewModel.(I want my ViewModel tells somehow to my View where to locate player). Just help me with approach to this problem.
My View:
<!--bottom row-->
<ContentControl Grid.Row="10" Grid.Column="10" Content="{Binding Cards[0]}" ContentTemplateSelector="{StaticResource CardTemplateSelector}"/>
<ContentControl Grid.Row="10" Grid.Column="9" Content="{Binding Cards[1]}" ContentTemplateSelector="{StaticResource CardTemplateSelector}"/>
...
<!--left column-->
<ContentControl Grid.Row="9" Grid.Column="0" Content="{Binding Cards[11]}" ContentTemplateSelector="{StaticResource CardTemplateSelector}"/>
<ContentControl Grid.Row="8" Grid.Column="0" Content="{Binding Cards[12]}" ContentTemplateSelector="{StaticResource CardTemplateSelector}"/>
...
<!--top row-->
<ContentControl Grid.Row="0" Grid.Column="0" Content="{Binding Cards[20]}" ContentTemplateSelector="{StaticResource CardTemplateSelector}"/>
...
<!--right column-->
...
<!--player chips-->
<ContentControl Grid.Row="10" Grid.Column="10" Content="{Binding Players[0]}" ContentTemplate="{StaticResource PlayerTemplate1}"/>
...
What I expect: 1)Model makes a dice roll(actually i have done this) 2)ViewModel gets this result and transform it to position on grid(have some ideas) 3)View must somehow get this position and move my player.