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.
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
Post a Comment