Windows Phone 8 Beginner's Tutorial (13) Setting the style of longlistselector in a tile

Source: Internet
Author: User

Original address: http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners/ Part-13-styling-tiles-in-the-longlistselector

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Series Address:http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners

Source code: HTTP://AKA.MS/ABSBEGINNERDEVWP8

PDF version:http://aka.ms/absbeginnerdevwp8pdf

In the previous lesson, we made a lot of progress in associating the new data model with MAINPAGE.XAML, and now we need to focus on the layout of Longlistselector's DataTemplate. We want to tweak each sounddata instance to make them look like tiles instead of rows. So, if we compare the current state of the application user interface with our drawings, the current layout is not reasonable. We'll improve on it in this lesson.

Plan:

We will modify the Longlistselector to take advantage of the grid layout pattern.

We'll completely rewrite each datatemplate to make them more like magnets.

Since we need five to six PivotItem, each pivotitem contains its own longlistselector, there is no need to define a tile layout for each PivotItem, So we're going to abstract them into a set of templates so that all the longlistselector in the MainPage.xaml can use it.

1. Change the longlistselector LayoutMode to Grid

The Longlistselector control contains a LayoutMode property. It accepts the list (default) or grid two enumeration values. By setting LayoutMode to grid and setting the size of cells based on length and height, we can quickly change the appearance of Longlistselector.

By adding lines 49 and 50, the longlistselector looks like this:

Each DataTemplate instance looks like a tile.

2. Modify DataTemplate To create the layout we need

Then we need to modify the DataTemplate to match the layout we want. I'll highlight and delete the contents of the DataTemplate:

Then I'll start with a grid of only one cell. In grid, I will use TextBlock to display the name of the sound at the bottom of the tile. I'm going to surround it with a stackpanel so I can set its vertical position later in the grid cell. So I added the following code to the DataTemplate:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.