Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Conditional View Model

$
0
0
I have a module that is a user control of a data grid. I want this data grid to be able to take any view model that implements IFreq_BO. The grid will then display the right columns depending on what view model was passed in.

My ViewModel for the module:
 class FrequencyEditVM : ViewModelBase
    {
        public FrequencyEditVM(ViewModelBase baseinterface, IFrequency_BO bointerface)
        { 
        } 

    }
I have 5 menu options, all of which will open this window with this user control data grid. But what I want is to make it so each menu option will pass a different view model to the constructor of this VM. I want to only write the code once for the control of course. How would I go about doing this with prism?

So I guess the core issue is: Depending on which menu option the user selects, how do I CONDITIONALLY inject one of 5 view models?

Viewing all articles
Browse latest Browse all 1878

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>