The main breaking change is that the `Bind` extension methods have moved from the individual Dialog projects to a shared location:
Cirrious.MvvmCross.Binding.BindingContext
If you use Dialog, then you will soon need to change your code to include a using for this namespace.
Beyond that, I've also included some excellent AutoView updates from @csteeg and I've committed some additional changes which:
- unify the DateTime Element behaviour across both platforms
- includes a default binding target name of Value for all ValueElements
- includes Expression based binding for all Elements.
You can see this new Expression based binding in:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
var target = this.CreateInlineBindingTarget<FirstViewModel>(); | |
Root = new RootElement("The Dialog") | |
{ | |
new Section("Strings") | |
{ | |
// can optionally include For statement like `v => v.Value` if not binding to default Element property | |
new EntryElement("Hello").Bind(target, t => t.Hello), | |
new EntryElement("Hello2").Bind(target, t => t.Hello2), | |
new StringElement("Test").Bind(target, t => t.Combined), | |
new BooleanElement("T or F", false).Bind(target, t => t.Option1), | |
new BooleanElement("T or F:", true).Bind(target, t => t.Option1), | |
}, | |
new Section("Dates") | |
{ | |
new DateElement("The Date", DateTime.Today).Bind(target, t => t.TheDate), | |
new TimeElement("The Time", DateTime.Today).Bind(target, t => t.TheDate), | |
new StringElement("Actual").Bind(target, t => t.TheDate) | |
} | |
}; | |
} |
To compare this to the previous code, see the diff in the revision history: https://gist.github.com/slodge/5706116/revisions - the old code will still work, but the new Expression based code may be easier to use because of its intellisense and refactoring support.
No comments:
Post a Comment