Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPF Sample #2

Open
timheuer opened this issue Jan 8, 2014 · 7 comments
Open

WPF Sample #2

timheuer opened this issue Jan 8, 2014 · 7 comments

Comments

@timheuer
Copy link

timheuer commented Jan 8, 2014

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

@MihaMarkic
Copy link
Contributor

Tim, out of curiosity, why would you use these bindings over native XAML ones.

@timheuer
Copy link
Author

timheuer commented Jan 9, 2014

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

@MihaMarkic
Copy link
Contributor

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.

@timheuer
Copy link
Author

timheuer commented Jan 9, 2014

Thanks @MihaMarkic -- I took a look at MvvmCross but this still seems to rely on XAML databinding -- am I missing something?

@MihaMarkic
Copy link
Contributor

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.

@timheuer
Copy link
Author

timheuer commented Jan 9, 2014

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.

@MihaMarkic
Copy link
Contributor

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)

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

No branches or pull requests

2 participants