简体   繁体   中英

What WP 8.1 XAML control could look and behave like the system Task switcher?

I'm writing a Windows Phone 8.1 Store app and I need to create a control so that it looks and behaves similar to WP 8.1 system task switcher (that appears when holding back hardware button).

It should show some images and support sliding left or right when swiping. Does anyone know what control should I use or do I need to create a completely new control from scratch?

So, the sollution was easy. The control I was looking for was... a ScrollViewer. It has 2 properties in WinRT XAML that make the ScrollViewer scrolling behave like I wanted: HorizontalSnapPointsAlignment and HorizontalSnapPointsType .

If you want to try this behavior, this MSDN code sample will expose it for you.

One point to mention. If you wish to set such behavior to, for example, a ListView you should firstly get its internal ScrollViewer in code and then set its HorizontalSnapPointsAlignment and HorizontalSnapPointsType properties. You can use GetFirstDescendantOfType<T>() extension method from WinRT XAML toolkit.

var sv = myListView.GetFirstDescendantOfType<ScrollViewer>();
sv.HorizontalSnapPointsAlignment = SnapPointsAlignment.Center;
sv.HorizontalSnapPointsType = SnapPointsType.Mandatory;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM