Question

I have ContractView. This is to be displayed from 2 separate tiles on my dashboard. One for baseload and one for peak load.

When showing baseload clips the title will be Baseload Clip Definition and when from the Peak Load tile on my dashboard, it will be Peak Load Clip definition

Likewise the ViewModel will need to get Baseload or Peak load clips depending on which tile the user has clicked on

I know one way I could do this is to make 2 separate copies but this seems totally wrong as it would duplicate the views.

On the view model size I am considering creating 2 seperate view models and inheriting them from a ClipDefinitionViewModel. The 2 new view model classes would then know the clip type to obtain from the data service

Is there a better way?

I am using Simple MVVM Toolkit

Paul

Was it helpful?

Solution

One class, two objects with different properties.

Have a Title property that you set when the VM is constructed (either pass into the constructor or set explicitly).

Likewise a LoadSource property can define where the VM should look for its definitions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top