Silverlight 3 Writable Bitmaps
A very useful feature of Silverlight 3 is its ability to render any UI element to a Bitmap. This capability is already used internally by Silverlight 3 to cache rendered controls but the possibilities extend much further than performance improvements. In games programming for example if you need to create a reflection in a scene in real-time, this is now an easy task using the WritableBitmap class.
You need to login to Download the default DropDown styles, If you do not have a login you can register for free!
To start with we have a grid containing four cells. The top-left cell is rendered as normal using a Button, TextBlock, TextBox and an Image that can be rotated. The three remaining grid cells contain ContentControl elements with rotations applied to give the impression of reflection, the content property of these is set at runtime:
The C# simply contains the Click event to handle the image rotation, the interesting part is the use of the WritableImage class to render the UI Element scene to a static bitmap:
We use a DispatcherTimer that frequently calls the Tick() method, and in this method we create our WritableBitmap instance and call its Render method which simply converts any UI Element into a bitmap. We then set the source of our three reflected ContentControl elements to this bitmap.
Rendering UI Elements to bitmaps is a simple but powerful addition to Silverlight and opens up a host of new applications such as graphic packages and as already mentioned special effects in games.
Guide the car to its parking space in this fun Car Parking game.
Aim for the Trash Can and get the various items of Trash in the bin.
Fly your plane in this colorful vertical scrolling shoot-em-up. Blast the bad guys and collect any bonus's they leave behind.
Pop as many bubbles as possible in this fun and colorful bubble popping game. The levels start off easy enough but gradually get harder!
Here we have a bunch of monsters that need to be matched up. Look out for the bomb and spinning monsters that will cause special damage!
Guide your friendly Bird through the maze of pipes and other obstacles collecting the Stars in this cool arcade game inspired by the legendary Flappy Bird.
You are stranded on an Alien planet. Your goal is to build a space rocket and escape. Start by building units to create power and mine the metal patches. Build defenses to defend your base from the advancing Aliens and Zombies!
Play Pool against the computer or battle against your friends in the online mode!
Slice the fruit that is thrown up onto the screen. Slice the fruit into multiple pieces for maximum points!