android - MvvmCross custom binding display dialog -
the goal display dialog user select date on tap on edittext
.
i'm truing implement binding show dialog on click. code following:
public class editdatebinding : bindingwrapper<edittext, datetime> { public editdatebinding(edittext androidcontrol) : base(androidcontrol) { } public override void subscribetoevents() { target.click += inputclick; } private void inputclick(object sender, eventargs args) { datetime parseddate = datetime.now; datetime.tryparse(target.text, cultureinfo.currentculture, datetimestyles.none, out parseddate); var dialog = new datepickerdialogfragment(target.context, parseddate, ondateset); dialog.show( // can't fragment manager here , "date"); } private void ondateset(object sender, datepickerdialog.dateseteventargs e) { setvaluetoview(target, e.date); } protected override void dispose(bool isdisposing) { base.dispose(isdisposing); if (isdisposing) { if (target != null) { target.click -= inputclick; } } } protected override void setvaluetoview(edittext androidcontrol, datetime value) { androidcontrol.text = value.toshortdatestring(); } }
but cant find way fragmentmanager
instance in order call show
method of instantiated dialog. can implemented in way?
found way implement it:
var act = (activity) target.context; dialog.show(act.fragmentmanager, "date");
Comments
Post a Comment