private void SetupControl() { imgPitch.ImageSource = ImageResources.GetImage(ImageResourceList.Pitch); // Paging control for formations FormationAdapter fa = new FormationAdapter(); foreach (Formation f in fa.GetFormations()) { FormationPaging.Items.Add(new PagingItem() { ID = f.UniqueID, Name = f.Name }); } // Create empty circles inside the grid // Set the PlayerGridPositions to blanks for (int x = 0; x < GRIDWIDTH; x++) { for (int y = 0; y < GRIDHEIGHT; y++) { // --- Marker symbol --- Markers[x, y] = GraphicUtils.Shirt(); Markers[x, y].VerticalAlignment = VerticalAlignment.Center; Markers[x, y].HorizontalAlignment = HorizontalAlignment.Center; Markers[x, y].AllowDrop = true; Markers[x, y].Drop += new DragEventHandler(Marker_Drop); Markers[x, y].Tag = x.ToString() + "," + y.ToString(); Grid.SetColumn(Markers[x, y], x + 1); Grid.SetRow(Markers[x, y], 8 - y); grdPitch.Children.Add(Markers[x, y]); // --- Text --- MarkerText[x, y] = new TextBlock(); MarkerText[x, y].Text = ""; MarkerText[x, y].Visibility = Visibility.Hidden; MarkerText[x, y].Foreground = Brushes.White; MarkerText[x, y].FontSize = 12; MarkerText[x, y].FontFamily = new FontFamily("Roboto Black"); MarkerText[x, y].VerticalAlignment = VerticalAlignment.Center; MarkerText[x, y].HorizontalAlignment = HorizontalAlignment.Center; Grid.SetColumn(MarkerText[x, y], x + 1); Grid.SetRow(MarkerText[x, y], 8 - y); grdPitch.Children.Add(MarkerText[x, y]); PlayerGridPositions[x, y] = -1; } } }