2

I would like to show design time data in Blend. I am using Template10 (from Hamburger base project) and I can't see design time data.

From this base project, I would like some help to display the design time data for the variable named "Value".

Thanks!

Samuel

Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233
Samuel LIOULT
  • 594
  • 5
  • 21
  • You can use a feature of the MVVMLight if you use it as a MVVM library. It is a pity that the Template10 ViewModelBase do not implement ant feature like the GalaSoft.MvvmLight.ViewModelBase.IsInDesignModeStatic ... I hope it will do in next releases. See the article http://blog.qmatteoq.com/the-mvvm-pattern-design-time-data/ and https://github.com/qmatteoq/MSFest-Samples Tempolate10Sample .... for the time being you have to use the ViewModelLocator with the dependency injections and IsInDesignModeStatic available in the GalaSoft library even though you use the Template10 ViewModelBase – Enzo Contini Apr 05 '16 at 10:13

1 Answers1

2

Designtime data is accomplished, typically, by loading view-model properties with sample data in the constructor of the view-model. If you are using the T10 project template, then there is already a placeholder where you can add this.

public MainPageViewModel()
{
    if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
    {
        Value = "Designtime value";
    }
}

Best of luck.

Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233