Welcome to MSDN Blogs Sign in | Join | Help

Silverlight Tips of the Day

General tips of Silverlight including but limited to game programming tips. Also, general Silverlight news and announcements.

November 2008 - Posts

Terrain Tutorial Part 1 – Creating a Scrolling Map
For this tutorial we will be generating a 2D scrolling map. The view is a straight down birds eye view. As shown in Figure 1 below, each terrain tile is represented by a combine upper-left and lower-right polygon. A map can be any width and height of Read More...
Silverlight Tip of the Day #24: How to Apply a XAML Template to a Class
Let’s say you have a class where you want to declare elements via a XAML template instead of dynamically creating them. For example, the XAML to declare an image and add it to a canvas would look like this: <Canvas x:Name= "MyCanvas" > Read More...
Silverlight Tip of the Day #23 – How to Capture the Mouse Wheel Event
Silverlight currently does not support mouse wheel events. However, you can attach an event to capture the mouse wheel movement through the HtmlPage object. This tutorial will show you how to do it for IE, Opera, Mozilla and Safari browsers. To start, Read More...
Silverlight Tip of the Day #22 – How to add Sound Effects, Music and Video to your Silverlight App.
No game is complete without a great sound track and sound effects! This tutorial will show you how to do both with a very small amount of code. Demo: (Silverlight 2 RTW required). Silverlight currently supports the following formats: Video WMV1-3 (Windows Read More...
Silverlight Tip of the Day #21 – How to work with Shapes, Brushes and Gradients
Shapes, gradients and brushes provide the user with a lot of power to make custom controls that look beautiful. For example, gradients can be made to look like shadows or lighting for stunning visual effects. For this demo, we are going to make the beginnings Read More...
Silverlight Tip of the Day #20 – How to Increase your Isolated Storage Quota.
Each application by default is given 1 MB of storage space through Isolated Storage where the server is able to store client specific data on the clients machine. So what if you need more than 1 MB? Fortunately, the IsolatedStorageFile object provides Read More...
Silverlight Tip of the Day #19: Using Isolated Storage
Silverlight uses Isolated Storage as a virtual file system to store data in a hidden folder on your machine. It breaks up the data into two separate sections: Section #1 contains administrative information such as disk quota and section #2 contains the Read More...
Silverlight Tip of the Day #18: How to Set Browser Cookies.
Cookies are strings of text that the server can store on the client side. These cookies can then be sent back by the client to the server each time the client accesses that server again. Cookies are commonly used for session tracking, authentication, Read More...
Silverlight Tip of the Day #17: How to Animate a Rotating Image
Each Silverlight element exposes a property called RenderTransform that is used to set the transform information that affects the rendering position of the element. I will be demo’ing a non-stop circular transform rotation of an image as seen here below: Read More...
Silverlight Tip of the Day #16 - StoryBoard versus DispatcherTimer for Animation and Game Loops.
In Tip of the Day #5 I discussed how to use the DispatcherTimer for your main game loop. However, a better approach may be to use the StoryBoard timer as discussed here or the CompositionTarget.Rendering event which was recently added to Silverlight 2. Read More...
Silverlight Tip of the Day #15 – Communicating between JavaScript & Silverlight
Communicating between Javascript and Silverlight is, fortunately, relatively straight forward. The following sample demonstrates how to make the call both ways. Calling Silverlight From Java script: In the constructor of your Silverlight app, make a call Read More...
Silverlight Tip of the Day #14 – How to Right Click on a Silverlight Application.
You may have noticed that right clicking on a Silverlight application brings up the following context menu and configuration dialog: Context Menu: Configuration Dialog: So what if you want to use right click in your application? While right click functionality Read More...
Silverlight Tip of the Day #13 - How to Get an Images Dimensions in Silverlight.
Since Silverlight is based upon an asynchronized model, getting an image width and height immediately after loading it is not possible. However, you can monitor its download progress and obtain the image dimensions once the progress has reached 100%. Read More...
Silverlight Tip of the Day #12 - Full Implementation of a Silverlight Policy Server.
Before a Silverlight application can connect to a server it must first successfully connect to a policy server on that machine in order to proceed with the connection. In this tip I will take you through every step you need to create and run your own Read More...
Silverlight Tip of the Day #11 – How to make your Silverlight Control Transparent.
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] In order to make your Silverlight control transparent to the background of your web site you have to do two things. From an ASPX page: Add the tag PluginBackground ="Transparent" Read More...
Silverlight Tip of the Day #10 – How to Dynamically Load and Display Images
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] Loading images in Silverlight is fairly straight forward. The first step is to create what’s called a Uniform Resource Identifier (URI). The URI is essentially a string that points Read More...
Silverlight Tip of the Day #9 – How to Capture the Size of your Browser when it is Resized.
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] For this tutorial, I will be showing you how to capture the size of your browser when it is resized. This is essential if you want to align your elements to the browsers borders, center Read More...
Silverlight Tip of the Day #8 - Silverlight Blogs and Resources
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] The following is my list of Silverlight Resources including blogs, tutorials and more. If you know of any other good ones please let me know as I will keep this list updated on a regular Read More...
Silverlight Tip of the Day #7: Creating Transparent PNG files for Silverlight
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] With GIF's, which aren’t supported in Silverlight2, transparency is fairly easy because you can just specify what color in that GIF you want to be your transparent color. With PNG's, Read More...
Silverlight Tip of the Day #6: Monitoring for Keyboard and Mouse Events.
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] Silverlight 2 provides full support for keyboard and mouse event handling. Not only can you monitor events for the entire application but you can also monitor them at the individual Read More...
Silverlight Tip of the Day #5: Timers and the Main Game Loop
Main Game Loop [Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] The main game loop is the heart of your game. In this function you will execute the majority of your game related tasks including: Game AI Animations - Updating objects Read More...
Silverlight Tip of the Day #4: Building the Game Interface Using the Grid Control.
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] Silverlight provides a <Grid> control that makes it very easy to plan and layout the user interface for your game. This control also supports imbedding grids within grids similar Read More...
Silverlight Tip of the Day #3: Silverlight Game Support, Limitations and Workarounds
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] While exploring techniques for game programming with Silverlight I came across some hurdles and discovered some workarounds. I plan to use this blog to track these issues for the purposing Read More...
Silverlight Tip of the Day#2: Creating a Silverlight Application Project with Visual Studio 2008
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] To start, let's create a new Silverlight Application in Visual Studio 2008! To do this, from the menu select File | New | Project as seen in Figure 1.1. If you wish to program in C# Read More...
Silverlight Tip of the Day #1: Setup and Installation of Silverlight and Silverlight Tools
[Blog Mirrored from http://silverlight.net/blogs/msnow/default.aspx ] Silverlight Tools is an add-on package that will allow you to develop Silverlight application using Visual Studio 2008 SP1. Click this link to install: Install Silverlight Tools RTM Read More...
Page view tracker