c# - Dynamic generation of ViewModel from Model -


i have model class contains array of command operations can performed on it. idea ui editing model instance can dynamically generated @ runtime; intend using dynamic xaml creation. far, good.

however viewmodel quite thing. question dynamic ui elements bind - need property in viewmodel bind to, appear need dynamically add properties vm instance , looking awfully messy.

alternatively, if binding send additional parameter allowed me bind single property used parameter decide value, cleaner , simpler solution.

or: don't know or haven't considered.

i've had success dynamic viewmodel objects using icustomtypeprovider - allows dynamically create binding points can built @ runtime.

http://blogs.msdn.com/b/silverlight_sdk/archive/2011/04/26/binding-to-dynamic-properties-with-icustomtypeprovider-silverlight-5-beta.aspx

bear in mind though if planning more complicated standard crud screens, trying build dynamic mvvm system non-trivial. lose out on attached properties, attached behaviours , inserting wpf goodies such type converters , implicitly-typed viewmodel rendering via datatemplates becomes problematic.

edit: wpf, you'll use equivalent icustomtypedescriptor


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -