wpf - Where to create parametrized ViewModel? -
I recently parametrized the controller of my ViewModel before, I was doing this in my window:
& lt; window. Datacontex & gt; & Lt; Vm: MyViewModel / & gt; & Lt; /Window.DataContext>
The framework made the view modal immediately for me.
I know that I can set up a data contact in the code, but I would prefer an XAM mode so that the designer could display my test data while designing.
Is this possible?
Use this if you want to specify the constructor parameter:
< Code> & lt; Window.DataContax & gt; & Lt; ObjectDataProvider ObjectType = "vm: MyViewModel" xmlns: sys = "clr- namespace: system; assembly = mscoribe" & gt; & Lt; ObjectDataProvider.ConstructorParameters & gt; & Lt; Sys: string & gt; A string parameter & lt; / Sy: string & gt; & Lt; Sys: Int32 & gt; 42 & lt; / Sys: Int32 & gt; & Lt; /ObjectDataProvider.ConstructorParameters> & Lt; / ObjectDataProvider & gt; & Lt; /Window.DataContext>
Comments
Post a Comment