Progress!  I may be talking to myself but I figure I should record any
answers beside the question.  I now have this XAML:

    <TextBlock Text="{Binding Foo}" />
    <TextBlock Text="{Binding Bar}" />

Binding to this map:

    {:foo "Foo value.", :bar "Bar value."}

.Net has custom type descriptors which allow you to tap into the
reflection process and mess with the results.  ClojureCLR maps
implement the CLR interface IDictionary so I have created a custom
type descriptor which takes an IDictionary and makes each member of
the dictionary available as a fake property.  The descriptor strips
the : from the name and I made it upper case the first letter to make
my XAML prettier.  Descriptors are described here:

    http://msdn.microsoft.com/en-us/library/ms171819.aspx

Wrapping a map for binding is easy:

    (defn make-bindable [data]
      (new MapTypeDescriptor data))

    (.set_DataContext window (make-bindable {:foo "Bar"}))

This is working in .Net 3.5 without using DynamicObject.  It seems
like a reasonable way to set up some conventions for writing standard
Clojure style and using the results with standard WPF style.

Anyone else looking at this sort of thing, or even interested?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to