[IronPython] StaticResources + DLR + Silverlight

Dan Eloff dan.eloff at gmail.com
Thu Jul 3 08:02:45 CEST 2008


On Wed, Jul 2, 2008 at 4:23 PM, Jimmy Schementi
<Jimmy.Schementi at microsoft.com> wrote:
>
> Painful indeed! Does XamlReader.Load work for Resources? Are you specifically templating the Resources? If not, you could use LoadComponent for those, and then XamlReader.Load to load "normal" XAML.

Actually this is the temporary workaround I'm using now for
development, but it won't work in production.

> Anyway, if you could give me a repro of what you're trying to do I could answer these questions for you. =)

Part of the reason I use templates is because it makes the xaml
simpler, I shed about 25% of the xaml that was just repetition. It
makes it much easier to maintain, especially because I edit it by
hand. With templates I eliminate duplication and I only have to change
things in one place. That part would hurt, but I can live without it.
But the other reason I use templates is because I don't have all the
information when I'm writing the xaml file. Many of the urls I use are
only known at runtime and cannot be part of the xaml file. There is no
easy workaround for this.

> Also, I'm assuming your doing the templating on the client for a reason ... =)

I have 0 xaml files, everything is templates that generate xaml. I
just find it easier to create the UI and populate it with data that
way. It's like with web frameworks. Sure you could use plain html and
script generated markup, but it's a mess and your UI logic gets all
mixed up in your backend code. It's much better if you can use a
templating language like in django, pylons, or rails to keep your
display logic separate from the backend code. The same is true in
Silverlight, xaml is just markup like html.

-Dan



More information about the Ironpython-users mailing list