Код: Выделить всё
int slotCount = _cardSlots.Count;
for (int i = 0; i < slotCount; i++)
{
Canvas.SetLeft(_cardSlots[i].Card.CardImage.Image, _cardSlots[i].ScreenRectangle.X );
Canvas.SetTop(_cardSlots[i].Card.CardImage.Image, _cardSlots[i].ScreenRectangle.Y);
}
Однако, если я использую тот же код, но не в цикле, изображения будут перемещаться. например:
Код: Выделить всё
Canvas.SetLeft(_cardSlots[0].Card.CardImage.Image, _cardSlots[0].ScreenRectangle.X);
Canvas.SetTop(_cardSlots[0].Card.CardImage.Image, _cardSlots[0].ScreenRectangle.Y);
Canvas.SetLeft(_cardSlots[1].Card.CardImage.Image, _cardSlots[1].ScreenRectangle.X);
Canvas.SetTop(_cardSlots[1].Card.CardImage.Image, _cardSlots[1].ScreenRectangle.Y);
Подробнее здесь: https://stackoverflow.com/questions/787 ... s-wpf-code