Link to Snippet

Building a WPF application in functional way

I started to write pure F# + WPF application in about half a year ago.
Today, I found a good way to compose WPF controls with dependent values.
It's only writing a dependency object type as a class and give it to constructors of GUI controls.
In this snippet "Volume","ColorVolume" and "ShapeContainer" has no properties.
But works as a View which represents internal Model and allows users to change internal data.
You only need calling a constructor of them.
It means that you can compose GUI controls and it's functionality as a immutable data structure.
(Update 2011/12/02 8:33:00(UTC+09:00) : Removed some user defined operators and renamed a type similar to DependencyObject in this snippet Reactor to SharedValue.)
(Update 2011/12/02 9:04:01(UTC+09:00) : renamed some variables..)

Multiple itemstype Slider = inherit RangeBase new : unit -> Slider member AutoToolTipPlacement : AutoToolTipPlacement with get, set member AutoToolTipPrecision : int with get, set member Delay : int with get, set member Interval : int with get, set member IsDirectionReversed : bool with get, set member IsMoveToPointEnabled : bool with get, set member IsSelectionRangeEnabled : bool with get, set member IsSnapToTickEnabled : bool with get, set member OnApplyTemplate : unit -> unit ...

type Shape = inherit FrameworkElement member Fill : Brush with get, set member GeometryTransform : Transform member RenderedGeometry : Geometry member Stretch : Stretch with get, set member Stroke : Brush with get, set member StrokeDashArray : DoubleCollection with get, set member StrokeDashCap : PenLineCap with get, set member StrokeDashOffset : float with get, set member StrokeEndLineCap : PenLineCap with get, set member StrokeLineJoin : PenLineJoin with get, set ...