ios - MvvmCross: MvxTableViewCell binding from outside -


i've created mvxtableviewcell subclass plan reuse @ many points of app, want delegate binding task creator of cell.

so far, got working based on n+1 tutorial examples, this code n=17-collect bull part 3 tutorial.

so @ point, creating cell looks this:

return new subtitlecell("titletext name; subtitletext subject.descripcion")) 

but don't bindings defined in strings, because refactor lot , may cause troubles in near future, decided declare binding normal bindable view this:

var cell = new subtitlecell(); var set = cell.createbindingset<subtitlecell, subjectgroup>(); set.bind().for(c => c.titletext).to(g => g.name); set.bind().for(c => c.subtitletext).to(g => g.subject.descripcion); set.apply(); return cell; 

this works before , it's refactor-safe, it's 6 times lines of code had before , binding must defined when instance of cell created.

i think can done using mvxbindingdescription because binding text used in first example parsed ienumerable<mvxbindingdescription>, unable find example or documentation it.

can point me right direction?

thanks.

edit: loc not biggest concern, having instantiate each cell before defining binding, i'd happy have this:

var set = mvx.createbindingset<subtitlecell, subjectgroup>(); set.bind().for(c => c.titletext).to(g => g.name); set.bind().for(c => c.subtitletext).to(g => g.subject.descripcion); 

so can apply later maybe this:

var cell = new subtitlecell(); cell.applybindingset(set); 

is there can done moving way?

update: noticed second binding example fills log console error:

mvxbind:warning:  0.40 unable bind: source property source not found cirrious.mvvmcross.binding.parse.propertypath.propertytokens.mvxpropertynamepropertytoken on null-object

both samples seems produce same behavior, warning errors appear using fluent binding.

mvxbindingdescription won't refactoring - operates above text or fluent bindings , below reflection level of binding engine.

if want expression based binding refactoring, have use fluent binding , pay penalty of lines of code (if consider penalty)


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -