×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Make a two column ListBox

    Hey guys, first post here.
    I'm making an application for Windows Phone 7, and in my main view, I'm trying to create a list, but with two columns, showing the same data. So instead of the data going straight down, it goes sideways, then down. Is this possible?

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Make a two column ListBox

    Can you add a mockup of what you're trying to do?

  3. #3
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: Make a two column ListBox

    Please refer the following XAML code

    <Grid >
    <Grid.RowDefinitions>
    <RowDefinition Height="50"></RowDefinition>
    <RowDefinition Height="50"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="100"></ColumnDefinition>
    <ColumnDefinition Width="100"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Button Content="Text" Grid.Row="0" Grid.Column="0"></Button>
    <Rectangle Fill="Blue" Grid.Row="0" Grid.Column="1"></Rectangle>
    </Grid>
    sreerajvr

  4. #4
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Re: Make a two column ListBox

    You can also use a WrapPanel from the WP Silverlight Toolkit that you can download from http://silverlight.codeplex.com/

  5. #5
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: Make a two column ListBox

    Thanks for the responses! I'm not sure if the Grid definitions will work though. So basically, I want a list of images. Say they are images 1, 2, 3 ... 10. Normal list view would show them as
    1
    2
    3
    4
    ...
    10

    But I want
    1 2
    3 4
    ....
    9 10. Would a wrap panel accomplish this?

  6. #6
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Re: Make a two column ListBox

    Quote Originally Posted by NujnaH View Post
    Thanks for the responses! I'm not sure if the Grid definitions will work though. So basically, I want a list of images. Say they are images 1, 2, 3 ... 10. Normal list view would show them as
    1
    2
    3
    4
    ...
    10

    But I want
    1 2
    3 4
    ....
    9 10. Would a wrap panel accomplish this?
    Yeah, it should. A wrap panel will fit as much as it can horizontally, before going to a new line. So if you set the width of your StackPanel (or whatever you're using for each list item) to the right size, you'll get two columns working nicely.

  7. #7
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: Make a two column ListBox

    Quote Originally Posted by Popple3 View Post
    Yeah, it should. A wrap panel will fit as much as it can horizontally, before going to a new line. So if you set the width of your StackPanel (or whatever you're using for each list item) to the right size, you'll get two columns working nicely.
    sweet, i'll try that out tonight. thanks

  8. #8
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: Make a two column ListBox

    You can also use attached Properties of XAML
    eg: you can set the value of Grid.Column on a button/images assigned to a button variable as follows

    Grid.SetColumn(button, 1);
    sreerajvr

  9. #9
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: Make a two column ListBox

    i ended up using a wrap panel. it worked out really nicely. i hope my app gets published now

  10. #10
    Registered User
    Join Date
    May 2014
    Posts
    1

    Re: Make a two column ListBox

    Quote Originally Posted by NujnaH View Post
    i ended up using a wrap panel. it worked out really nicely. i hope my app gets published now
    I have also used WarpPanel as ItemPanel for ListBox control, but it results into OutOfMemory exception when the collection is big. This is because WrapPanel doesn't use Virtulisation.

    Can anybody help me on this issue.

Similar Threads

  1. changing listbox column layout
    By decryptor in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-06-24, 07:48
  2. listbox and column length
    By jack44 in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-12-09, 11:50
  3. How to change the row height in column listbox?
    By khanming in forum Symbian User Interface
    Replies: 3
    Last Post: 2003-03-11, 12:49
  4. Column listbox with Headings
    By mark_williams in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-02-26, 02:51
  5. Icon in column listbox does not appear
    By khanming in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-06-26, 12:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×