Providing ViewModel data in design mode for Blend and VS

In an MVVM-based application, what parameters should I provide for representing ViewModel data during development, our designers can really see something in Blend3 (and VS 2008). How do you do this? Can I use mc: for something this is not possible?

+3
source share
2 answers

Yes, Expression Blend can help you with this. Use the Data tab to create sample data that has the same shape as your production data. When you create a data source, be sure to uncheck the "Enable sample data when the application is running."

http://www.smips.com/brad/stackoverflow/design-model1.jpg

, , DataContext XAML. , Blend.

<navigation:Page DataContext={StaticResource MyFakeDesignData}

Loaded , DataContext . , , , , , .

private void Home_Loaded(object sender, RoutedEventArgs e)
{
    DataContext = new MyRealViewModel();
}
+4

VS2010, Design-Time ( SL, WPF). , :

  • XMLNS: d = "http://schemas.microsoft.com/expression/blend/2008"

  • /

    < UserControl.Resources >  < ViewModels: MockXViewModel x: Key = "DesignViewModel" / > </UserControl.Resources >

  • < Grid d: DataContext = "{ = {StaticResource DesignViewModel}}" > ...

.

+3

Source: https://habr.com/ru/post/1716126/


All Articles