Vishful thinking…

Generics support in XAML

Posted in C#, Silverlight by viswaug on March 31, 2009

Support for creating generic classes in XAML is still lacking. The only XAML element that lets you specify the generic type argument is only the root element of the user control. I couldn’t find any way to create an instance of a generic class in XAML yet. One had a class called “NameValue” in the project and wanted to be able to create an ObservableCollection<NameValue> in XAML. The only way I was able to do it in XAML was to create another empty class called NameValueCollection that inherited from ObservableCollection<NameValue> and then create an instance of the “NameValueCollection” in XAML instead.

public class NameValueCollection : ObservableCollection<NameValue>

I think one way generics could be supported in XAML is by creating new MarkupExtensions for that purpose.


Avoid using properties called “Name” in your Silverlight classes

Posted in Silverlight by viswaug on March 31, 2009

This is something that I ran into a little while ago. I had a property called “Name” in one of my Silverlight classes that was getting created in XAML. When I created the class in XAML all the properties on the class got applied as set in XAML except for the “Name” property. As usual, I assumed I was doing something wrong and was trying to figure out where i messed up. After, trying to debug this for a while and loosing my self-esteem as a developer, I realized that Silverlight just doesn’t like setting the property called “Name” in XAML. It works fine when you set it in code. It is just XAML that messed with my head for a little while there. So, avoid the mistake I made and retain some sanity.

Extreme makeover – ESRI Silverlight API edition

Posted in ESRI, Silverlight by viswaug on March 31, 2009

One of the good things about the custom controls in Silverlight is the fact they can be styled any way seen fit by designers without any intervention by developers at all. This gives developers a really good clean way of working with designers simultaneously. All the designer needs to be aware of are the template parts that make up the custom control and they can be on their way to designing it and animating for the various states defined in the custom Silverlight control and provide animations for transitions between states. The documentation for the ESRI Silverlight API Navigation widget template part is not there yet but that shouldn’t necessarily hold you back. Microsoft Expression Blend will get you on your way styling it any way you like. The default look of the navigation widget didn’t get us too excited about it. So, we had our designer re-work the looks of it and here are the before and after pictures.

nav_old downarrow-thumb nav_new



I am excited to see what others will start doing with it.