mvvm - Mvvmcross: launching an android dialog containing a ListView -
first, give big kudos stuart lodge awesome framework. xamarin's visual studio integration, 1 of productive cross platform frameworks have laid hands on.
what want achieve launch dialog containing selectable listview when button clicked. need access selected item when user closes dialog. there recommended way using mvvmcross' dialog plugin while following mvvm paradigm?
i using following activity create dialog.
[activity(theme = "@android:style/theme.holo.dialog")] public class searchresultdialogview : mvxactivity { protected override void oncreate(bundle bundle) { base.oncreate(bundle); setcontentview(resource.layout.searchresultview); } }
navigating searchresultdialogviewmodel
view model brings view modal. looks heading in right direction. however, dialog missing ok , cancel buttons , rid of default header. think need alertdialog far have had no success launching 1 code:
[activity(theme = "@android:style/theme.notitlebar")] public class searchresultdialogview : mvxactivity { protected override dialog oncreatedialog(int id, bundle args) { alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("some title"); return builder.create(); } }
apologies if question vague. new android ui development.
tia.
there several different uses of word dialog here.
- android dialogs 'popup displays' , covered in http://blog.ostebaronen.dk/2013/02/using-dialogs-in-mono-for-android.html
- the mvvmcross dialog plugin code-based form-builder forked existing monodroid.dialog , monotouch.dialog tools - see https://github.com/migueldeicaza/monotouch.dialog
- the holo dialog display (actually i'm not sure) theme-based skin on normal
activity
.
with these in mind...
if want display general popup window collect data, can try using fragment based dialog collect data - demonstrated (with little code behind) in fragments homeview.cs namedialogfragment.cs - general background on fragments, watch n=26 in http://mvvmcross.wordpress.com/
if want use separate activity data collection, @gschackles wrote article on 1 way of returning data child viewmodels - http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/ - i'm sure other schemes used.
if want learn mvx dialog plugin, see n=23 in http://mvvmcross.wordpress.com/
Comments
Post a Comment