Before you can adjust the layout in Blend, you'll need to make a few adjustments in Visual Studio to include your design-time data in the Windows Store app project. With your design-time data prepared and wired up for your Windows Phone application, it's time to switch across to the Windows Store app. Adjust the XAML for the ItemTemplate to be the following, where the image is placed alongside the caption: You're now in template-editing mode, where you can adjust the layout of each item in the ListBox. Right-click the ListBox and select Edit Additional Templates | Edit Generated Items (ItemTemplate) | Edit Current. Before moving on, you'll tweak the ItemTemplate slightly. Right-click on the ListBox and select Reset Layout | All, which will resize the ListBox to take up the available space. When you release the mouse cursor, Blend will create a ListBox, data bind the ItemsSource property (at design time, to the Chairs collection of your design-time data) and create an initial ItemTemplate that controls how each item in the ListBox is presented. With your design-time data created, you just need to drag the Chairs node across into the main area of the design surface. You should have a collection called Chairs, where each item has a String, Caption, and an Image, PhotoUrl. ![]() Figure 2 shows the structure of the sample data you want to work with after renaming the collection and properties. When you click OK, you'll see that a SampleData folder is created in the Windows Phone application and nodes are added to the Data window. Accept the default name and location of the new set of design-time data, but uncheck the "Enable sample data when application is running" checkbox. Then from the Data window, click on the "Create sample data" icon in the top-right corner, and select New Sample Data. In Blend, open the MainPage of the Windows Phone application. I'll leave Visual Studio for a moment and step across to Blend for Visual Studio in order to create some design-time data. Make sure both Windows Phone 8 and Windows Store applications reference the PCL, as this is where the view model that will power the interface will reside. Configuring target frameworks for the Portable Class Library. As Figure 1 illustrates, in the PCL I've removed support for Silverlight and older versions of Windows Phone. In this article I'll look at how you can take design-time data created for Windows Phone and use it to design Windows Store apps for Windows 8.īefore I look at design-time data, I'll walk you through setting up the basic structure of an application, which will have three projects: a Windows Phone application (DesignForWP), a Windows Store app (DesignForWin) and a Portable Class Library, or PCL (DesignShared). What this means is that features such as IntelliSense and design-time data have been refined, making it much more efficient to create amazing applications. One area where Windows Phone developers have the upper hand is that we're now on the third iteration of the tooling for Windows Phone. There's a significant overlap in the development story for Windows Phone and Windows 8.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |