O'Reilly logo

Mastering Xamarin UI Development - Second Edition by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Randomly shuffling our Game Tiles on the Game Board

In this section, we will look at implementing the ShuffleBoardTiles_Clicked instance method in our ViewController class. The ShuffleBoardTiles_Clicked instance method will be responsible for randomly shuffling our GameTiles on the game board, which, if you remember when we were constructing our user interface for our game, we created an event for with our Shuffle Tiles button.

We will use the Random class to generate a random number that will be used to specify a new location to place each of our GameTile images on the game board.

Let's start by modifying the ViewController class for our SlidingTiles app by performing the following steps:

  1. Ensure that the ViewController.cs file is currently ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required