After looking at the alternatives I decided that a custom markup extension
was the best way of binding to resources in XAML. It seems that people have
had the idea before, but I made my own much smaller class derived from
MarkupExtension and I have it return strings and Images. A typical element
looks like this:
<Button x:Name="fooButton" x:Uid="FooButton" ToolTip="{app:MyRes}"
Content="{app:MyRes Default=My Default}" ... />
In my extension I combine the Uid and name of the property being set to make
a unique resource lookup key and return the value.
There is a small amount of plumbing to make the extension suit my needs. It
creates and caches a static ResourceManager on first use. It has a default
value so that you see something in the designers. You can derive from the
class and override the name of the ResourceManager class to be used. It acts
as a kind of extension and converter at the same time.
Most importantly, I'm happy that the XAML doesn't get too cluttered.
Greg
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf