|Visual Basic (Declaration)|
Public Event TileLoaded As EventHandler(Of TiledLayer.TileLoadEventArgs)
public event EventHandler<TiledLayer.TileLoadEventArgs> TileLoaded
This event is only fired if the tile is being downloaded over an http(s) connection. If the image data is readily available when returned from the GetTileSource method, only the TileLoading event will trigger.
In order to use the TileLoaded Event in Silverlight you must elevate the trust settings of the application. If you do not elevate the trust settings for Silverlight you will not be able to set breakpoints in Visual Studio for debugging or have those blocks of code execute. By elevating the trust settings you are no longer able to run the application an internet browser. These trust settings do not need to be elevated for WPF and Windows Phone 7 applications as they already have their trust privileges elevated and work by default for the TileLoaded Event.
To elevate the trust in a Visual Studio Silverlight project to use an 'Out-of-Browser' host, open the Project Properties tab and check on the 'Enable running application out of the browser' checkbox. This will enable the 'Out-of-Browser Settings...' button. Then click the 'Out-of-Browser...' button and when the 'Out-of-Browser Settings' dialog opens, check on the 'Require elevated trust when running outside the browser' checkbox. You can specify a different 'Window Style' if desired for the 'Out-of-Browser' application. Click the OK button to close the 'Out-of-Browser Settings' dialog and save the changes. See the following screen shots:
Note: When you make changes to Visual Studio to run the Silverlight application in 'Out-of-Browser' mode, the startup project for the solution file changes from the 'Web' project to the core project. If you desire to go back to using an internet browser to host the Silverlight Application and not use the functionality of the TiledLoaded Event, you need to un-check the 'Enable running application out of the browser' checkbox and perform one additional step. The additional step involves opening the Visual Studio Solution Explorer tab, right clicking on the 'Web' version of the application and choosing the 'Set at StartUp Project' from the context menu. See the following screen shot:
If you do not perform this additional step when you try to run the Silverlight application back in the internet browser, the Map Control will contain an error similar to the following: "Invalid URI scheme 'file://' for map control. Control must be hosted in a HTTP(S) website." and the Address bar of the internet browser will be trying to point to a specific file (like: C:\...) rather than a web site (like: http://...). Unfortunately, Visual Studio does not perform this additional step as of version 2010 and it must be performed manually. See the following screen shot:
The event handler receives an argument of type TiledLayer.TileLoadEventArgs containing data related to this event. The following TiledLayer.TileLoadEventArgs properties provide information specific to this event.
|Column||Gets the tile column.|
|Error||Gets the error loading tile if a problem occured accessing the tile.|
|ImageSource||Gets or sets the tile image source. You can set this in the event handler to intercept and modify tiles.|
|ImageStream||Gets the tile image stream.|
|Level||Gets the tile level.|
|Row||Gets the tile row.|
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family