When a button is clicked on my XML, an image tag is created and on object is added to my list in my viewmodel.
This is the object that is created
public unit(float x, float y, int team)
{
this.X = x;
this.Y = y;
this.team = team;
this.speed = speed;
this.rect1 = new Rectangle(x, y, 0.1, 0.1);
}
When a different button is clicked, the unit.x is increased by 0.05.
I wish to bind my image tag position to the x and y of its unit object.
So if I click the buy button 3 times without clicking the move button, there should be 3 image tags perfectly on top of each other.
This is how my image tag is handled
<AbsoluteLayout>
<ListView x:Name="units_list_view" ItemsSource="{Binding Unit_list}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Image Source="tank.png" AbsoluteLayout.LayoutBounds="{Binding rect1}" />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</AbsoluteLayout>
It never moves even as x increases, and doesn't start at the x and y of the unit.
How can I set the absolute position of my image tag to the x and y value of the object it's bound to?
Here is all relevant code, just in case