This code still needs a little tinkering with - it will change as we go across to the other platforms, but a basic first pass is in this Gist:
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
private KeyedDescription GetMenuAutoView() | |
{ | |
var auto = new ParentMenuAuto() | |
{ | |
new MenuAuto(caption: "New", | |
longCaption: "New Customer", | |
icon: "ic_menu_add", | |
command: () => AddCommand), | |
}; | |
return auto.ToParentMenuDescription(); | |
} | |
private KeyedDescription GetListAutoView() | |
{ | |
var list = new ListAuto(key: "General", | |
itemsSource: () => Customers, | |
selectedCommand: () => CustomerSelectedCommand); | |
list.DefaultLayout = new ListLayoutAuto<Customer>(key: "General", | |
layoutName: "TitleAndSubTitle") | |
{ | |
new BindingAuto<Customer>("Title", c => c.Name), | |
new BindingAuto<Customer>("SubTitle", c => c.Website) | |
}; | |
return list.ToDescription(); | |
} | |
public bool SupportsAutoView(string type) | |
{ | |
switch (type) | |
{ | |
case MvxAutoViewConstants.List: | |
return true; | |
case MvxAutoViewConstants.Menu: | |
return true; | |
default: | |
return false; | |
} | |
} | |
public KeyedDescription GetAutoView(string type) | |
{ | |
switch (type) | |
{ | |
case MvxAutoViewConstants.List: | |
return GetListAutoView(); | |
case MvxAutoViewConstants.Menu: | |
return GetMenuAutoView(); | |
default: | |
return null; | |
} | |
} |
Next up MonoTouch, and then WP and WinRT
Then back to Droid for Tab UIs too :)
No comments:
Post a Comment