Open timheuer opened 10 years ago
Tim, out of curiosity, why would you use these bindings over native XAML ones.
@MihaMarkic good question! :-) -- I am presently the owner of the Binding framework for XAML and always explore how people are doing things differently. I understand Frank's motivation to be more iOS/Android approached (which doesn't have a similar binding engine), but I also want to see if for some simple cases this could be a better performing approach than how Binding works in the native stack. My suspicion is that it may not be (or be similar) due to requiring reflection techniques...but I'd like to know. Additionally, this should work for other client technologies like WinForms (which I can't get it to work either).
Make sense? Maybe the question is better suited to why this isn't working in a WinForms app.
Sure it makes sense, good answer to a good question :) BTW, you might take a look the awesome binding Slodge is doing in MvvmCross. Much more advanced and open compared to XAML stuff.
Thanks @MihaMarkic -- I took a look at MvvmCross but this still seems to rely on XAML databinding -- am I missing something?
Not exactly, the base is similar but there is much more to it https://github.com/MvvmCross/MvvmCross/wiki/Databinding For example check out Tibet binding that does advanced stuff.
Thanks...the Wiki confuses me as to the actual syntax and where it gets used. And I'm not finding the sample in the repo there to be helpful to see a working example of it. It is unclear to me if this is just PropertyPath goodness on top of {Binding} or a new implementation and what the markup looks like in general.
Those bindings are custom made, cross platform and don't rely on XAML bindings at all. Some of the fundamentals and ideas are similar. For example, you can bind against (literally) "FirstName + ' ' + LastName" That's pretty neat. In XAML one would have to use multibinding with formating for that. Then you can use custom expressions, like "100 * Ratio" or ValueCombiners (some come out of the box but one is free to create them) like: "Format('Hello {1} - today is {0:ddd MMM yyyy}', TheDate, Name)" or "If(Something, TrueValue, FalseValue)" And you can even use ValueConverters as functions, allowing to combine them: "RemainingLength(TweetText,140)" // where RemainingLength is a ValueConverter
That's really powerful, clear and RADis IMHO. The same functionality in XAML would require a TON of code in zillion converters. (all sample code taken from mvvmcross binding tutorial)
Awesome Frank! Have you tried this with a basic WinForm/WPF app? I may be an idiot and fresh off vacation but doesn't seem to be working as I change values in the textboxes...