why not just implement interface for all blocks that share common properties and then cast it to that interface inside view? why you need block view model? and btw, page view model is evil either ;)
The interface will probably work for me. I will have to adjust some of my ViewModels to implement that interface and expose some of those properties. Thanks for the suggestion. Why do you see PageViewModel is evil?
I am trying to create some consistency to my blocks (i.e. title, padding, background-color) so I created a layout for a block. I followed the IPageViewModel and created a IBlockViewModel
and that is the model of my layout class. T has properties about the block title, background-color, etc.. I followed the same procedures as how the pages are done from the Alloy Sample.
That works great when I have a block that has a controller, but for simple blocks that just display a few properties I don't have a controller (for performance reasons). The problem is that the model that is getting passed to those views is Castle.Proxies.[MyBlock]. I need it to be IBlockViewModel
. Is there anyway I can adjust the model that is getting passed in without creating a Controller for all my blocks?
Is there an alternative to what I am trying to do? Please any suggestions would be greatly appreciated.