Silverlight 4 Hosting :: The Advantage Using Silverlight 4 in the the ArcGIS Silverlight

Namespace prefixes

In Silverlight 3.0 you had to use multiple namespace prefixes to access classes in XAML that were located in different namespaces. This meant you often ended up with something like this in the page header:


In Silverlight 4 we can now map multiple namespaces to the same xmlns prefix, and the 2.0 API takes full advantage of this both in Silverlight and WPF. This means that you don’t have to declare multiple prefixes for core, geometry, symbols, toolkit, etc… but can just use one for them all:


This is what it looks like in intellisense:

So even though the following four objects are all in different namespaces, the namespace prefix is the same:

<esri:Map />

<esri:Navigator />

<esri:MapPoint />

<esri:SimpleMarkerSymbol />

Graphic.Attributes Binding

Before Silverlight 4, support for binding to dictionaries was lacking compared to WPF, and you had to use a custom converter to access attributes on a graphic feature. In Silverlight 4.0, this is now much easier, and you will never have to use the DictionaryConverter again (round of applause please):

Silverlight 3 (assuming the DataContext is the Graphic.Attributes, for example inside a MapTip):


    <esriConverters:DictionaryConverter x:Key=”MyDictionaryConverter” />


<TextBlock Text=”{Binding Converter={StaticResource  

    MyDictionaryConverter},ConverterParameter=StateName}” />

Silverlight 4:

 <TextBlock Text=”{Binding [StateName]}” />

Even more interesting is that you can now update your attributes inside a map tip by simply using Two-Way binding on a textbox:

<TextBox Text=”{Binding [StateName], Mode=TwoWay}” />

From now on consider the DictionaryConverter to be obsolete. 

The attributes type has also been updated (implements IDictionary) so if you bind to the attributes and change any values, it will automatically trigger a rebind.


By far the #1 requested feature, not only for our API, but also for Silverlight in general. Silverlight 4 finally comes to the rescue and provides an API for printing. You simply give it a control to print:

PrintDocument doc = new PrintDocument();

doc.PrintPage += (s, e) =>


   e.PageVisual = MyMap;

   e.HasMorePages = false;



Binding to DependencyObject

Prior to Silverlight 4, you were only allowed to set binding expressions on objects that inherit from FrameworkElement. This limitation has been relaxed so now you can bind to anything that inherits from DependencyObject (like in WPF). This means you can bind an attribute to a symbol and rotate it based on the attribute value. Example:

<esri:MarkerSymbol x:Key=”MySymbol”>



       <TextBlock Text=”=>”>


           <RotateTransform Angle=”{Binding Attributes[Heading]}” />





</esri:MarkerSymbol >

Design Time editor in Visual Studio 2010

Visual Studio 2010 now supports previewing and editing your XAML in design view, similar to what you did in Expression Blend. Our design time support works the same way in Visual Studio as in Blend, so you can now use Visual Studio to do some quick design-time editing.   However, I do believe Blend is still an invaluable tool and has very powerful support for creating good looking layouts, animations, etcetera.

Comments are closed.


Cheap Reseller Hosting

Best Blog Hosting Provider

Best European ASP.NET 4.0 Hosting Provider