Hi,

I am doing some experiments to see how ClojureCLR could help with some
of the challenges in building WPF applications.  My question is, what
sort of Clojure object can I use as a data context for WPF data
binding?

For example, given the following XAML:

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

Using Clojure I would like to set the data context to something simple
like a map:

    {:Foo "Bar"}

In C# I would normally set its data context to a class like this:

    class MyData
    {
        public string Foo { get { return "Bar"; } }
    }

At run time WPF reflects on the data context, finds Foo and displays
it's value, "Bar".  In .Net 4 I can also bind to a dynamic object:

    class MyData : DynamicObject
    {
        public override bool TryGetMember(GetMemberBinder binder, out
object result)
        {
            result = "Bar";
            return true;
        }
    }

Foo can't be found, so TryGetMember is called and WPF displays "Bar".
One possible solution would be to proxy this if ClojureCLR compiled
for .Net 4.

Can anyone else suggest another direction for me to investigate?

Cheers
Barry

-- 
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