This project is read-only.

NavigateAction to View Model with generic type definition possible

Feb 6, 2011 at 3:07 PM

Hi,

I would like to use the NavigateAction to navigate to a view which has an associated VM that has a generic type definition, is this possible as I can't see how I can pass "T"?

[MapViewModel(typeof(WidgetConfigurationView

))]

 

public class WidgetConfigurationViewModel<T> : NavigationViewModelBase{}

Thanks in advance for any help.

 

 

Feb 8, 2011 at 12:36 AM

Without going into more complex/advanced ways of doing so, you can simply define the ViewModel on the View itself, like so:

[MapView(typeof(WidgetConfigurationViewModel<MailWidget>))]    
public partial class MailWidgetConfigurationView : UserControl
{
    //
}        

or alternatively use DefineViewViewModel to achieve the same.

Cheers,
Rishi