Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Derived properties in WinForms #23

Open
john-patterson opened this issue Oct 4, 2016 · 2 comments
Open

Derived properties in WinForms #23

john-patterson opened this issue Oct 4, 2016 · 2 comments

Comments

@john-patterson
Copy link

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.

@smoothdeveloper
Copy link

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

@john-patterson
Copy link
Author

@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. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants