zzarchive-FSharp.Desktop.UI icon indicating copy to clipboard operation
zzarchive-FSharp.Desktop.UI copied to clipboard

Derived properties in WinForms

Open john-patterson opened this issue 8 years ago • 2 comments

Even though this is a WPF framework, we're fitting it for WinForms. I know there's a [<DerivedProperty>] that Binding.OfExpression uses to do multi-way binding in the case of computed properties. In WinForms the Binding.OfExpression does not work because, I assume, WinForms is not compatible with the WPF binding framework.

I made a [<DerivedFrom(string array)>] attribute that lets you mark the direct dependencies of the computed properties on your model and hijacked the body of the Intercept method on the IIntercepter on the Model, so that when a setter is called, I check to see if there are any children pointing to me as a dependency.

I am still working on a couple nice-to-haves like transitive dependency resolution and memoizing reflection results, but it mostly works. Is this something that could be made into a pull request? I know it is a little strange thematically as this is a WPF framework.

john-patterson avatar Oct 04 '16 20:10 john-patterson

@john-patterson the good thing about this repository is that the name itself doesn't imply it is WPF specific :)

I'm also using winforms and I'd be interested if you could push samples in your fork.

smoothdeveloper avatar Oct 04 '16 20:10 smoothdeveloper

@smoothdeveloper Sure thing. I just pushed what I have so far to my fork. https://github.com/john-patterson/FSharp.Desktop.UI/commit/96dfc6d1e1702c5b29a1644a9972d3b3c0e1a9b8

I have a unit test ready for transitive dependency, but I'm still working on implementing. :)

john-patterson avatar Oct 04 '16 20:10 john-patterson