Example #1
0
 public void Select(SquareView selectedSquareView, Point mousePos)
 {
     selected = true;
     this.selectedSquareView = selectedSquareView;
     this.mousePos           = mousePos;
     Panel.SetZIndex(this.selectedSquareView, 1);
 }
Example #2
0
        public GamePage()
        {
            InitializeComponent();
            DataContext               = viewModel = new GamePageViewModel();
            GameBoardGrid.MouseMove  += Grid_MouseMove;
            GameBoardGrid.MouseLeave += Grid_MouseLeave;

            // Create squareViews and images inside it
            for (int i = 1; i <= G.r; i++)
            {
                for (int j = 1; j <= G.c; j++)
                {
                    squareViews[i, j] = new SquareView {
                        DataContext = viewModel.table[i, j]
                    };
                    squareViews[i, j].MouseLeftButtonDown      += LMDown;
                    squareViews[i, j].PreviewMouseLeftButtonUp += LMUp;
                    GameBoardGrid.Children.Add(squareViews[i, j]);
                    squareViews[i, j].SetValue(Grid.RowProperty, G.r - i);
                    squareViews[i, j].SetValue(Grid.ColumnProperty, j);
                }
            }
        }