mishan
mishan

Reputation: 1217

Horizontal LongListSelector and/or alternatives

On one page in my project (Windows Phone 8 C#/XAML App) I have a pivotcontrol containing grid of custom buttons on every page.

Now, since I don't need the headers, it's without them, but I want/need an indicator stating which pivot is selected and/or a way to select pivot without swiping.

That's why I have a created a custom radiobutton-like control by styling a button and adding "Selected" dependency property to it. Now I'd like to make a HORIZONTAL list of those buttons and use them to select pivotitems.

I've been searching for a way to make horizontal longlistselector, but can't find anything useful.

What I'd like to achieve is something like this:

--------------------------------
|       USERPANEL - DONE       | //done
|------------------------------|
| ------------    ------------ |
| |          |    |          | |
| | button   |    | button   | |  //buttons and everything else is done
| |          |    |          | |
| ------------    ------------ |
| ------------    ------------ |
| |          |    |          | |
| | button   |    | button   | |
| |          |    |          | |
| ------------    ------------ |
| ------------    ------------ |
| |          |    |          | |
| | button   |    | button   | |
| |          |    |          | |
| ------------    ------------ |
|                              |
|    ===  ---  ---  ---  ---   | //this is the line with horizontal list
|                              | //of buttons 
-------------------------------- // === is selected button, --- is not selected

Now, all of the layouts and buttons are there and working, but I'd like to make the longlistselector in the bottom, using my buttons

So my questions are:

How to make a horizontal longListSelector?

Should I use something else instead? Is there an easy alternative?

Is it even a good way to use longlistselector like that?

Upvotes: 1

Views: 246

Answers (2)

Justin XL
Justin XL

Reputation: 39006

First, a LongListSelector is designed for handling large amount of data. I don't think you need it in this case.

A much simpler way would be -

  1. Create a Grid panel and put it to bottom of your screen and divide its width by the number of controls you want to put in.

  2. Create RadioButtons and simply style them to Button. This way you don't even need to create your custom Button control. Also RadioButton handles 'de-selecting' automatically, another thing you don't need to do manually.

Upvotes: 1

Depechie
Depechie

Reputation: 6142

Well I've used the WrapPanel for something similar! You get a Horizontal or Vertical layout...

Take a look at an in depth example here: http://www.geekchamp.com/articles/wp7-wrappanel-in-depth

Upvotes: 1

Related Questions