c# - View and Model data formats -


how define format of data used in view , model?

i understand viewmodel here data model, convert (if necessary) , supply view (and in opposite direction):

user <--> formatted data (converters) <--> view <--> converted data (to used generic view) <--> viewmodel <--> raw data <--> model

now problem? want pass operationprogress model view:

class operationstep {     string _name;     bool _iserror;     int _time;     ... }  class operationprogress {     list<operationstep> _steps;     operationstep _currentstep;     // int _currentstepindex;     int _currentsteptime;     ... } 

viewmodel converts operationprogress bunch of bindable properties (list<bool> of errors, current step name , time countdown) , view uses them (and converters!) display progress user.

i willing create specialized control handle progress display, avoid same repeatable data conversion primitive types in viewmodels.

but fail figure out how define data format control... using operationprogress in view control directly (exposing in viewmodel , binding it)? creating controlprogress (progress data specially control)? benefits if viewmodel has convert operationprogress controlprogress? using controlprogress in model (doesn't feels right).

so here come. if guys similar (passing bunch of data, not string or int, model view or in opposite direction) how organize it?

you have decide weither can live datatemplate targetting operationprogress type, or if have create full mvvm stack operationprogress. depends on complexity of data, , interaction data.

edit:

you said :

i willing create specialized control handle progress display, avoid same repeatable data conversion primitive types in viewmodels.

but want, far understood, not control, full mvvm stack conversion operationprogress controlprogress encapsulated in new vm.

so, call "a specialized control handle progress display" become operationprogressview, , "controlprogress" become operationprogressviewmodel.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -