In a previous post I created a second page for my Universal (Windows/Windows Phone) applications which was placed in the Shared project. Unfortunately Blend doesn’t support design time data for XAML pages that are in shared projects. However, there is a trick to get the design time data wired up and displaying for these pages.
I’ll start by opening the MainPage for the Windows application, which is in the Windows project as it’s not shared with the Windows Phone application. From the Data pane I can go ahead and create a sample data set. There are different ways to partition your sample data – I prefer to have a sample data set per page; in this case the data is for SecondPage, which is in the shared project.
In this case my design time data is just going to be made up of a single complex entity, CurrentProperty
Next I am going to remove the SecondPageDataSource that was created on the MainPage and add it instead to the Application.Resources section in the App.xaml. Note that I needed to add the d, mc and SampleData namespaces.
<SampleData:SecondPageDataSource x_Key=”SecondPageDataSource” d_IsDataSource=”True”/>
Now when I open up the SecondPage I’ll see that there is a SecondPageDataSource under the Data pane.
One thing to be aware of is that this will only exist when designing the Windows application. Unfortunately you’ll need to create a different sample data set for use when designing the page for Windows Phone.