MvvmCross Android - Alternative to RelativeSource binding for button command -
i have list of items bound mvxbindablelistview mvxitemtemplate. have 4 items in list bound view. data gets updated , view displays new data fine.
now, want add 2 buttons item template. however, relative source binding not available mvvmcross. (see image)
but i'm having difficulties working out solution this.
i have tried itemclick binding of list item, gives me 1 possibility of click , need 2.
can help?
see second option in answer in mvvmcross changing viewmodel within mvxbindablelistview - covers 1 way this.
using approach you'd expose list of objects like:
public class wrapped { public icommand gothrucommand { get; set; } public icommand opencommand { get; set; } public string name { get; set; } }
and you'd use axml list template bound controls like:
<textview ... local:mvxbind="{'text':{'path':'name'}}" /> <button ... local:mvxbind="{'click':{'path':'gocommand'}}" /> <button ... local:mvxbind="{'click':{'path':'thrucommand'}}" />
if you've got suggestions/requests relative source in mvx, please add them https://github.com/slodge/mvvmcross/issues/35
Comments
Post a Comment