If you have the Silverlight 3 SDK RTM version (not the GDR) installed on your box you will need to first uninstall it before running Visual Studio 2010 beta 2 setup.
This is irrespective of the SDK language version or platform. The SDK GDR does not install on top of the RTM version of the SDK. This problem should be remedied by RTM.
If you proceed with install in this state you will get an error at the end of install stating that the SDK failed to install. This error does not affect your setup of beta 2 for Visual Studio but you will still need uninstall to SDK RTM and re-install the SDK GDR if you wish to get the latest version of the SDK.
To uninstall the RTM version of the SDK:
- Go to your Add/Remove programs.
- Select Microsoft Silverlight 3 SDK.
- Right click on it and choose uninstall from the context menu.
At this point you can proceed with installation of Visual Studio 2010 Beta 2 which can be downloaded from here.
Note that you can install the SL3 GDR SDK directly from here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=1ea49236-0de7-41b1-81c8-a126ff39975b.
Thank you,
--Mike
Out of browser support allows Silverlight applications to run as a stand alone application out of the browser. This is especially useful if you have an application that you want to run when you are offline and unable to connect via the browser.
Configuring your Silverlight application to run out of browse is fairly straight forward in VS. To do so, follow these steps:
- Right click on your Silverlight project in the solution explorer and choose Properties.
- From the Properties window click on the Silverlight tab and check the box labeled “Enable running application of out the browser.” Next, click the Out of browser settings button as seen below.
- This will bring up the Out-of-Browser Settings dialog as seen below. Fill out the fields to match your desired settings. Notice that if you do not want to use the default icon you can specify your own images. Click the OK button when you are done.

- At this point your application supports running out of browser.
- To install the Silverlight application on your desktop run it and then right click on the application to invoke the context menu as seen below.
- Choose Install SilverlightApplication…onto this computer. This will bring up a dialog that lets you choose where to install the application to.
- At this point your application will be installed and launched in an out of browser window. Clicking on the icon (as seen below) on your desktop or start menu will automatically launch the application in a window outside of your browser.
Thank you,
--Mike Snow
Subscribe in a reader
Tomorrow, June 30th, is the release date for my book titled “Game Programming with Silverlight”. Writing this book was a great experience as it was the first book I have ever written. It was extremely time consuming mostly because it was a learning experience but I am glad I did it.
Also, I apologize for the lack of Silverlight tips these days! Finishing the book was my top priority but I am looking forward to getting back to adding Silverlight tips on a regular basis.
The book itself covers a lot of what I discuss here in this tips blog but with more detail. Here is a quick outline of what I covered in the book:
Chapter 1: Silverlight 101. I start the book off by giving a thorough introduction into Silverlight, XAML and Silverlight controls.
Chapter 2: Getting Started. This chapter covers using Visual Studio 2008 and 2010 for creating Silverlight projects.
Chapter 3: What’s new with Silverlight 3. I cover each and every new feature to Silverlight 3 that could pertain to game development.
Chapter 4: Silverlight Tips and Tricks. Mostly tips I covered here in my blog.
Chapter 5: Creating the World. Covers the map editor I created that allows you to create maps for your games. Also, I discuss resources where you can obtain game art from.
Chapter 6: Object Manager. I discuss how to use a web service to load objects from. Also, I cover the different types of objects you might have in a multi-player adventure type game.
Chapter 7: Animation. This chapter discusses the variety of ways to perform animation in Silverlight.
Chapter 8: The Client UI. I discuss the ways you can lay out your client UI in your game.
Chapter 9: Network Support: I discuss how to make your game multi-player using socket programming.
Chapter 10: Extras: In this final chapter I discuss a variety of topics such as how scrolling maps smoothly, player movement, chat boxes and reflections.
Let me know if you have any suggestions or ideas on what you would want to see in a future book (Game Programming with Silverlight 4 for example).
Thanks!
--Mike
Animation Easing allows for you to apply built in animation functions to your Silverlight controls. The result is a variety of animation effects that make your controls move in a more realistic way. For example, you can add springiness to your controls, set how many times you want it to bounce when it hits a destination point, etc. The functions that you can set include:
- BackEase – Moves the ball backwards by an amount specified through its amplitude before moving forward.
- BounceEase – Created an effect like a bouncing ball.
- CircleEase – Accelerates the animation based upon a circular function.
- CubicEase - Accelerates the animation based upon a cubic function.
- ElasticEase – Uses springiness and oscillation to animate.
- ExponentialEase – Accelerates the animation based upon an exponent value.
- PowerEase – Accelerates the animation based upon a power of time.
- QuadraticEase – Accelerates the animation based upon the square of time.
- QuarticEase – Accelerates the animation based upon the cube of time.
- QuinticEase – Accelerates the animation based upon the time to the power of 5.
- SineEase – Accelerates the animation along a sine wave.
Each of these has can have an EasingMode set to one of the following options:
- EaseOut – Ease takes place at the beginning of the animation.
- EaseIn – Ease takes place at the end of the animation.
- EaseInOut – EaseIn takes place for half the animation followed by EaseOut.
In addition, you can set the Duration, From and To values for the animation.
The best way to see what each of these do is to simply to try them out via this demo. Try modifying any properties that are specifically unique to the animation.
The animation functions listed above are applied directly to a storyboard that is then used to target and animate a given control. The XAML I use for each ball is as follows:
<UserControl x:Class="BouncingBall.Ball"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas>
<Canvas.Resources>
<Storyboard x:Name="BallSB">
<DoubleAnimation x:Name="BallDA" Completed="DoubleAnimation_Completed" From="0" To="1000" Duration="0:0:05"
Storyboard.TargetName="TargetBall" Storyboard.TargetProperty="(Canvas.Top)">
<DoubleAnimation.EasingFunction>
<BounceEase x:Name="Easing" Bounces="10" EasingMode="EaseOut" Bounciness="2"></BounceEase>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</Canvas.Resources>
<Image x:Name="TargetBall" Source="ball.png" ImageOpened="Image_ImageOpened"></Image>
</Canvas>
</UserControl>
Thanks,
--Mike
From within VS you can specify which Internet browser you want launched when running your Silverlight application. Your default system browser is not affected by this setting.
To make this change right click on your startup web page and choose Browse with… from the context menu. This will bring up the following dialog.
From within this dialog select the browser you want to use and choose “Set as Default”. Close the dialog when you are done.
Thank you,
--Mike Snow
Subscribe in a reader
With the release of Silverlight 3 Beta 1 GPU (Graphics Processing Unit) acceleration (or hardware acceleration) is now available. The GPU is a processor attached to your graphics card that is generally used for calculating floating point operations. In addition, it contains a number of graphics primitives that when used will save you a lot of CPU time.
By default this option is disabled and to use it you must enable it both on your Silverlight control/plug-in as well as any of the controls you want to leverage it.
To enable it on your Silverlight control open your web page that hosts the Silverlight control.
For HTML modify the Silverlight control to include the following param:
<param name="EnableGPUAcceleration" value="true" />
For ASPX add the following attribute:
<asp:Silverlight ID="Silverlight1" EnableGPUAcceleration="true" runat="server" Source="~/ClientBin/MyApp.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />
Now, to apply it to a control you will need to add CacheMode="BitmapCache” to the control. The following example shows you how to add it to an Image control:
<Image CacheMode="BitmapCache" Source="MyImage.png"></Image>
Currently BitmapCache is the only option. What this does is it causes visual elements (and all their children) to be cached as bitmaps after they have already been rendered. Once cached, your application can bypass the expensive rendering phase for the cached elements and just display them.
If you want to test out what is being cached in your application add the following attribute to your Silverlight control:
<asp:Silverlight EnableCacheVisualization="true" ID="Silverlight1" EnableGPUAcceleration="true" runat="server" Source="~/ClientBin/MyAPp.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />
Uncached objects will appear tinted where as cached objects will not be tinted.
This feature is supported on:
-
Windows: Both full screen and non-full screen
-
Mac: Full screen only.
This feature should be used when the following are occurring to your control:
-
Transformations (translating, rotating, stretching, etc.).
- Clipping.
- Blending.
Thank you,
--Mike Snow
Subscribe in a reader
Of the course of the last year I have been collecting links to some really good Silverlight tutorial blogs that I thought I would share with you. These are active blogs, frequently updated, that are specifically oriented to teaching Silverlight development. That is, they are all about showing you how things are done and giving you the source code you need to do it yourself. If I have missed any good links post a comment and I will add it!
Silverlight tutorial sites in alphabetical order:
Also, here is a great Silverlight Blog summary page: http://www.netvibes.com/rboarman#Silverlight
Thank you,
--Mike
When calculating the positions of objects such as Images make certain to use integer values not floating point values.
For example, take a look at this code that centers a map around a given position:
private void CenterMap(double windowWidth, double windowHeight)
{ if (null != _parentCanvas)
{ int leftPos = (int) ((windowWidth / 2) - _currentX);
int topPos = (int) ((windowHeight / 2) - _currentY);
_parentCanvas.SetValue(Canvas.LeftProperty, (double) leftPos);
_parentCanvas.SetValue(Canvas.TopProperty, (double)topPos);
}
}
Notice I converted the map layout position left and top to be integers. The following screen shot shows an example where double values were used instead of integers. The result is the images are slightly blurred and lines (or seams) appear between the image tiles.
Compare the screenshot above that used doubles with the shot below that used integers. In the screen shot below the images are crisp and the terrain tiles have no seams or lines.
Thank you,
--Mike Snow
Subscribe in a reader
By default Silverlight will not download an image more than once if is contained within the image cache. That is, as long as the URI remains the same it will reference the image from the cache.
So what if the image changed on the server even though it has the same URI? Your application can force an update by setting the property IgnoreImageCache to true.
Example:
Image img = new Image();
Uri uri = new Uri("http://YourServer.com/MyImage.png", UriKind.Absolute);BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage(uri);
bi.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
img.Source = bi;
LayoutRoot.Children.Add(img);
Thank you,
--Mike Snow
Subscribe in a reader
Unless you have had your head under a rock you probably have heard Silverlight 3 Beta 1 has been released! If you haven’t already, please install it from http://silverlight.net/getstarted/silverlight3/default.aspx
This release comes packed with some of the greatest features to date. If you are a game developer, you will be happy to hear the following features below are now included in Silverlight 3. I will be writing detailed blogs on a number of these to help you apply them to your application.
Image Opened
In Silverlight 2 it was difficult to accurately determine when a image was completely opened. This case was often needed to determine the actual dimensions of the image. The problem occurred because the DownloadProgress is fired at 100% before the image is fully decoded. The solve this, a new event called ImageOpened is available. Now you can be guaranteed to get the right size for the image. Example:
private void LoadImage(string fileName)
{ Image img = new Image();
Uri uri = new Uri(fileName, UriKind.Relative);
img.Source = new System.Windows.Media.Imaging.BitmapImage(uri);
img.ImageOpened += new EventHandler<RoutedEventArgs>(Image_ImageOpened);
}
void Image_ImageOpened(object sender, RoutedEventArgs e)
{ Image img = (Image)sender;
BitmapImage bi = (BitmapImage)img.Source;
double width = bi.PixelWidth;
double height = bi.PixelWidth != _radius)
}
XAP Compression
Optimization were made to drastically reduce the size of the XAP file. You can expect the XAP file size to now be on par (if not better) than Windows zipping. Games often come packed with a lot of content so obviously the smaller your XAP the faster your customers will be able to download your game.
Perspective 3D
Perspective 3D transforms can now be applied to Silverlight controls via the PlaneProjection property. This allows you to rotate a 2D control in a 3D plane.
Example code that shows how to do this:
<Image Source="Man.png">
<Image.Projection>
<PlaneProjection RotationX="45"></PlaneProjection>
</Image.Projection>
</Image>
Pixel Shaders
Pixel shaders allow you to apply effects to controls such as images. There are two built in effects available by default: Drop Shadow and Blur. In addition, you can write and apply your own custom effects.
The following images show the result of applying pixel shader effects to them.
Example code to accomplish this through a built in shader:
<Image Source="dwarf.jpg">
<Image.Effect>
<BlurEffect></BlurEffect>
</Image.Effect>
</Image>
Binding
You can now bind controls to properties of each other. For example, the Text of a TextBlock can bind to the Text of a TextBox. Or, a TextBox Text can bind to the Value of Slider. Example:
<StackPanel>
<TextBox x:Name="UserText"></TextBox>
<TextBlock Text="{Binding Text, ElementName=UserText}"></TextBlock></StackPanel>
Whatever someone types in the TextBox is automatically reflected in the TextBlock.
Bitmap API
Bitmap APIs are now available through a class called WriteableBitmap. This method takes as parameters the surface width and height and the pixel format.
Example code:
WriteableBitmap wb = new WriteableBitmap(0, 0, PixelFormats.Bgr32);
wb.Render(img, new ScaleTransform());
wb.Lock();
// walk through WriteableBitmap[]
wb.Invalidate();
wb.Unlock();
Hardware Acceleration
Silverlight now makes use of the GPU (Graphics Processing Unit) for rendering which frees up CPU time for other tasks. The GPU typically sits on a video card. It is a dedicated graphics processing device that is used for a variety of tasks such as calculating floating point operations.
Animated Text Performance Improvements
A property called TextRenderingMode now allows you specify RenderForAnimation. This turns off optimizations that could directly affect text animation such as scaling, rotating, etc. The result is a smother, more peformant animation of text. Example on how to set this property:
RenderOptions.SetTextRenderingMode(MyTextbox, TextRenderingMode.RenderForAnimation);
Network Monitoring API
There are now API’s that allow you to monitor the status of the network. To see if a network is available you can call:
bool isConnected = NetworkInterface.GetIsNetworkAvailable();
You can also hook up an event that will fire when the network status changes:
NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
To access these methods you will need to reference the namespace System.Net.NetworkInformation;
SaveFileDialog
Finally we are able to save files in Silverlight! Calling this method will invoke a dialog that will allow you to specify a file to save to. The method returns a pointer to a Stream that you can than write to. Example code:
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "map files (*.xml)|*.xml|All files (*.*)|*.*";
sfd.ShowDialog();
System.IO.Stream stream = sfd.OpenFile();
// Save your data here
stream.Flush();
stream.Close();
Make certain to flush and close the stream or the file will not be created.
CaretBrush
The CaretBrush is useful because you can now change the appearance of the caret. This was a problem if, for example, you wanted to have a background color of a textbox set to back. The cursor was also black so it would not appear. Example on how to set it:
<TextBox Foreground="White" Background="Black" Width="200" Text="Hello">
<TextBox.CaretBrush>
<SolidColorBrush Color="White"></SolidColorBrush>
</TextBox.CaretBrush>
</TextBox>
Resulting Screenshot (notice the white caret):
Local Connection
This feature allows two separate Silverlight applications to communicate with each other on the client side without the need to roundtrip to the server.
Implementing this is fairly straight forward. Start by creating two separate Silverlight applications. To one, add this code that will listen for a message:
LocalMessageReceiver receiver = new LocalMessageReceiver("R2D2");receiver.MessageReceived += new EventHandler<MessageReceivedEventArgs>(receiver_MessageReceived);
receiver.Listen();
You will need to reference System.Windows.Messaging to make these calls. The constructor for LocalMessageReceiver takes any unique identifier.
To the other application add this code that will send a message to the first Silverlight application:
LocalMessageSender sender = new LocalMessageSender("R2D2");sender.SendCompleted += new EventHandler<SendCompletedEventArgs>(sender_SendCompleted);
sender.SendAsync("Hello World!");
Navigation
Navigation is now supported in Silverlight. This allows you to do things like hook up navigation in your Silverlight application to the Back and Forward buttons of your browser. A new template called “Silverlight Navigation Application” is available that demonstrates how to do this.
Essentially to accomplish this you will need to put your main page in a <navigation:Frame>. You add history by this call:
this.Frame.Navigate(new Uri(currentPage, UriKind.Relative));
Then, when the back and forward buttons of your browse are clicked this frame object will intercept them and display the correct page.
System Colors
You can now get access to a users settings for their System Colors. These are available through System.Windows.SystemColors.*. Example: System.Windows.SystemColors.ActiveBorderColor. This will allow ou present a contrast that matches a user's settings.
Other
- Out of Browser Experience – Allows you to run your Silverlight application as a desktop application.
- Assembly Caching – Enables non-core runtime extensions to be cached.
- ManagedResourceDictionary – Manage resources files in separate files.
- New controls – A number of new controls have been added.
- H.264 / AAC Media Playback – Newly supported Media format.
- Animation Easing Effects – Grants more visual effects including smoother transitions.
- Media Logging – Allows you to collect data about a customer and their meda experience. The data is posted back to one or many servers for analysis.
Thanks,
--Mike Snow
I recently had the opportunity to try out the controls from ComponentArt.com. I was very impressed with their ease of use, professional design and overall quality. Also, their staff are very prompt to responding to questions which made my developer experience a lot easier. Overall, they are very friendly and easy to work with.
ComponentArt currently has a Beta 2 release available here; I highly recommend you check it out!
The Silverlight controls they currently support include:
Let’s take a look at the Toolbar, Menu, Data Grid and Tree View controls.
Toolbar
The following screenshots shows you what the toolbar looks like in each of the available themes. These themes can be applied to all controls. For the toolbar, you can enable/disable items, change orientation from horizontal to vertical, and more. Also, you can have a seperate icon represented for enabled, disabled and hover.
Black Ice
Arctic White
Office 2003
Office 2007
Windows 7.
Example code needed to create a toolbar:
<ComponentArt:ToolBar Width="600" x:Name="MainToolbar" Canvas.Left="250" ItemOrientation="Horizontal" >
<ComponentArt:ToolBarItem Icon="Arrow.png" Click="ToolBarItemSelect_Click" ></ComponentArt:ToolBarItem>
<ComponentArt:ToolBarItem Icon="Draw.png" Click="ToolBarItemDraw_Click" ></ComponentArt:ToolBarItem>
<ComponentArt:ToolBarItem Icon="Dropper.png" Click="ToolBarItemDropper_Click" ></ComponentArt:ToolBarItem>
<ComponentArt:ToolBarItem Icon="Fill.png" Click="ToolBarItemFill_Click" ></ComponentArt:ToolBarItem>
<ComponentArt:ToolBarItem Icon="Erase.png" Click="ToolBarItemErase_Click" ></ComponentArt:ToolBarItem>
<ComponentArt:ToolBarItem Icon="Grid.png" Click="ToolBarItemGrid_Click" ></ComponentArt:ToolBarItem>
</ComponentArt:ToolBar>
Menu
The following screenshot shows an example menu in action.
With menus you can change how they expand and collapse. You can make it so they instantly expand or you can send an interval for the rate of acceleration or deceleration. You can also set whether they expand when hovered or expand when clicked. There are a lot more settings that make the menu extremely customizable to your needs.
Example code needed to create a menu:
<ComponentArt:Menu ExpandDuration="0" ExpandTransition="None" Width="222" ExpandDelay="0" x:Name="MainMenu" MenuClick="MainMenu_MenuClick">
<ComponentArt:MenuItem ItemLabel="File" >
<ComponentArt:MenuItem x:Name="MenuItemNewMap" ItemLabel="New Map..."/>
<ComponentArt:MenuItem x:Name="MenuItemOpenMap" ItemLabel="Open Map..."/>
<ComponentArt:MenuItem x:Name="MenuItemSaveMap" ItemLabel="Save Map..."/>
<ComponentArt:MenuItem ItemLabel="Close"/>
</ComponentArt:MenuItem>
<ComponentArt:MenuItem ItemLabel="Layers">
<ComponentArt:MenuItem x:Name="MenuItemLayer1" IsCheckable="True" IsChecked="True" ItemLabel="Layer 1"/>
<ComponentArt:MenuItem x:Name="MenuItemLayer2" IsCheckable="True" IsChecked="True" ItemLabel="Layer 2"/>
<ComponentArt:MenuItem x:Name="MenuItemGameObjefts" IsCheckable="True" IsChecked="True" ItemLabel="Game Objects"/>
</ComponentArt:MenuItem>
<ComponentArt:MenuItem ItemLabel="Help">
<ComponentArt:MenuItem ItemLabel="Search"/>
<ComponentArt:MenuItem ItemLabel="Contents"/>
<ComponentArt:MenuItem ItemLabel="Index"/>
</ComponentArt:MenuItem>
</ComponentArt:Menu>
Data Grid
The data grid is probably one of the more impressive controls. Columns can be resized and re-ordered. Check out the screen shot here:
You can also group rows by area:
TreeView
The following screen shot shows the tree view in action.
The tree view supports icons, drag/drop, node editing, tree view lines styles (none, solid, dotted), tree view line colors, multiple selection, enabling and disabling nodes and more.
Given a tree view control:
<ComponentArt:TreeView x:Name="TreeViewObjects" Width="220" Height="300"></ComponentArt:TreeView>
The following snippet of code shows you how easy it is to add nodes to the tree:
public void CreateRootNode()
{ TreeViewNode rootNode = new TreeViewNode();
rootNode.Header = "Mailbox";
TreeViewObjects.Items.Add(rootNode);
}
Any data you want to store with a node in the tree can be set in the TreeViewNode.Tag property.
Thank you,
--Mike Snow
Subscribe in a reader

I would like to announce that I am currently working on a book titled “
Silverlight Game Programming” due to be released around June this year! You can find it on Amazon by clicking
here.

It’s taking most of my blogging time up so I apologize for the lack of blogs recently.
Based on Silverlight 3, this book walks you through how to create a multi-player online RPG in Silverlight. Included is a Map Editor written in Silverlight that allows you to create maps for your game.
Map Editor Features include:
- Object Templates – The base template for all objects that can appear in your game. These objects are stored in XML and include generic object properties such as name, description, image(s), animation properties and more.
- Advanced Object Placement- Draw, Drag/Drop, Fill, Delete, Undo, Redo.
- Object Editing – Objects added to the game can be fully customized by changing their properties. For example, a creatures strength, a potions potency, a weapons damage, etc.
- Collision Detection – Each object in the template can have a polygon that represents its collision zone.
- Animation – Preview your animated objects in the map editor.
Triggers – Triggers cause events to fire when walked on. For example, triggers can activate traps, warp a player to another map, play a music file, etc.
- Terrain Editing – The Map Editor allows you to place tiles on different layers and it also allows you to apply opacity masks to these tiles for impressive tile transition effects.
- Undo/Redo – Undo or redo your last action.
- Map Generation – Create maps of any height and width. In addition, you can specify the radius of each tile.
Here is a screenshot of the Map Editor (in early development):
Let me know if you have any suggestions or comments about what you are hoping to see out of the book.
Thank you,
--Mike
I recently stumbled across a cool tool by EnvyGames that allows you to generate sprites from 3D Models and their animation files. This tool, called SpriteWorks, is ideal for creating high quality sprite animations and one that I’ll be adding to my arsenal of game development tools for Silverlight. Since Silverlight does not yet support 3D models, sprite animation is really the only way to go.
On a side note, EnvyGames is also working on a Silverlight Game Engine. For a complete list of features visit this link: http://www.envygames.com/content/?page_id=327. A beta is due out in a number of weeks.
Once you have installed SpriteWorks make certain to have the following installed or the tool will not work:
- Microsoft Visual Studio 2008 or Microsoft Visual C# Express 2008.
- Microsoft XNA 3.0
SpriteWorks currently supports importing the following 3D file formats:
- DirectX (.X)
- Torque Game Engine (.DTS)
- Autodesk (.FBX)
This tool is still undergoing improvements and fixes and I would recommend using it with Torque models for the best result.
I will now give a quick overview on how the tool works. Start by launching SpriteWorks, Click the Browse button and choose your 3D model. In the left pane a preview of the model will appear.

If your model doesn’t appear at first click the Camera tab and adjust the Camera Angles and Position until the model is centered in the preview window.
Next click the Model tab and open up your Animation Sequence file. You can click the Play button to preview the animation.
Finally, when you are ready click the Output tab. Enter the Output File Name, check the “Animate this model” checkbox and click the “Create Sprite Sheet” button.
The tool will start taking a snapshot of each animation frame.
The tool will go up to 52% and sit there for a minute or two before completing. Be patient here, the tool has not hung!
The result is a PNG file that has each sequence of the animation in it:
Thank you,
--Mike Snow
Subscribe in a reader
Once you have an image loaded how do you go back and get the original file name for the source file?
This can be accomplished through the Uri property of the images Source. However, you must first typecast the images Source to be a BitmapImage. The Uri has a property called OriginalString that returns the full relative path to the image file.
Example:
public string GetImageSourceFile(Image img)
{ BitmapImage bi = (BitmapImage) img.Source;
Uri uri = bi.UriSource;
return uri.OriginalString
}
Thank you,
--Mike Snow
Subscribe in a reader
If you ever run into this error when running your application you might be a bit perplexed by its encrypted meaning.
Looking at the exceptions details you will see something like which really doesn’t help you very much:
System.Windows.Markup.XamlParseException occurred
Message="AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 4 Position: 53]"
LineNumber=4
LinePosition=53
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MapEditor.TerrainTile.InitializeComponent()
at MapEditor.TerrainTile..ctor(Double xLoc, Double yLoc, Double tileRadius)
InnerException:
The Silverlight Team is working to make improvements in error reporting. For now, to better understand what is causing these errors you should take a careful look at your XAML to see if something declared is missing or wrong. For example, say you have an event handler in your XAML that is not anywhere to be found in your code behind. Often I find myself removing an event handler I no longer want in my code behind but forgetting to remove it in my XAML as well.
Now you know (if you didn’t already).
--Mike
Next