I am developing a map application in Silverlight. I have a type polygon containing the coordinates of the polygon along with a string containing the name of the Brush resource loaded into the application. I attach this object directly to a template for drawing polygons. This template has a padding property of type System.Windows.Media.Brush.
My goal is to allow xaml-parser to search for the resource, given that I only have the brush name and not the resource itself.
In Silverlight, I want to achieve something similar to what Pedro Sampaio shows in WPF in this blog post: http://www.e-pedro.com/2009/06/using-data-binding-with-static- resources-in-wpf / . He created a BindableStaticResource that inherits the StaticResourceExtension-type. Then he can do the binding as follows:
<Polygon Fill="{BindableStaticResource {Binding NameOfFillResource}}" />
Very elegant! But this does not seem to be an option in Silverlight, since the MarkupExtension-type subtype does not exist. I am new to Silverlight and can't think of a good, reusable way to implement this.
Thank! Haraldv
source
share