Sunday, December 28, 2008

F# CTP and Silverlight 2 and XAML

Following up from yesterday, the rudiments of the clock, to show XAML integration in the F# plus Silverlight combination. This should be enough of a template for starting with and mutating to taste.

The code is unchanged in the Feb 2010 (v 1.9.9.9) CTP.

astroclock.xaml:

which we note has a UserControl as root, and astroclock.fs:

with the obvious AppManifest.xaml:

LATER: Data binding sort of works sometimes; I can get it to work when set at run-time to bind a string to a TextBlock via myTextBlock.DataContext <- this.StringProperty (but not yet through XAML), and Sliders are being totally recalcitrant...

I think there is some autogeneration magic just not happening for F# -- the best I can get seems to be to approximate a one-time binding -- so it's back to wiring up events by hand.

Post a Comment