开发者

WP7 Complex Layout

开发者 https://www.devze.com 2023-03-22 16:13 出处:网络
I want to make a complex layout, and would like advice on the best way to go about this. Here is the behaviour I\'m looking for: Layout of some text blocks and some images, such that a tap anywhere o

I want to make a complex layout, and would like advice on the best way to go about this.

Here is the behaviour I'm looking for: Layout of some text blocks and some images, such that a tap anywhere on the layout will go to another related page to that item. I want a long list of this item in a scroll viewer.

First, I tried to make a grid, add the items in it, then add this grid in the outer grid, the main one for pressing, I made an event handler for mouse click, but a problem appeared; that when I try to scroll "on the item to view the all list" the event handler fired!, I tried the mouseButton up and down, and the same happen

Second, I'm not sure if it's an efficient way to make it. I want a good way to design this complex layout, and of course it will be a programmatic way, and a way to recognize the开发者_如何学运维 item I press on.


It sounds like you're trying to create your own ListBox control. Using this will give you the scrolling functionality for free, and you can use the ListBox's SelectionChanged event to determine when an item has been clicked.

The best way to design the layout will depend on how complex it actually is. If it merely contains an image and some text, you should have no problem hand-coding that in XAML. If there's a lot more to it than that, I'd recommend looking into Microsoft's Blend tool. Whichever route you choose to produce the XAML, you will place the code in the ListBox's ItemTemplate, which determines how each item in the ListBox is displayed.

A good walkthrough of something similar to what you're doing can be found at http://weblogs.asp.net/psheriff/archive/2010/10/27/windows-phone-list-box-with-images.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消