Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:06:36+00:00 2026-05-24T03:06:36+00:00

I have a simple listbox with more items than fit on the screen. If

  • 0

I have a simple listbox with more items than fit on the screen. If you scroll to the last item it is shown but then drops back off the screen – I can’t leave it in view. After an hour of Googling it seems to be a known issue in early versions of the Listbox but it still seems to be the case in the latest tools. There also seems to be a problem with fixed heights and virtualization, but setting the height at item level or listbox level makes no difference. I see the Listbox in the WindowsPhoneDataBound app template works fine with scrolling and no heights.

I would also like a solution without fixed heights so that it does not require a new state for Landscape orientation.

Any suggestions please?

My listbox is in a usercontrol that is in a PivotItem:

        <controls:PivotItem x:Name="pivotItemSetup" Header="setup">
            <local:listBoxBlindsControl Margin="0,0,-12,0"/>
        </controls:PivotItem>

and the user control:

 <Grid x:Name="LayoutRoot" Background="Transparent">
        <ListBox x:Name="listBoxBlinds" ItemsSource="{Binding BlindSet.Blinds}" SelectionChanged="MainListBox_SelectionChanged" Height="500">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Height="80" Margin="0,0,0,17" Width="103">
                        <StackPanel Orientation="Horizontal"  Visibility="{Binding IsBreak, ConverterParameter=true, Converter={StaticResource boolToVisibility}}" VerticalAlignment="Top" d:LayoutOverrides="Width">
                            <TextBlock Text="{Binding LevelNumber, ConverterParameter='level \{0\} - ', Converter={StaticResource stringTextConverter}}" TextWrapping="NoWrap" Margin="0" Style="{StaticResource PhoneTextExtraLargeStyle}" d:LayoutOverrides="Width"/>
                            <TextBlock Text="{Binding SmallBlind, ConverterParameter=\{0\}/, Converter={StaticResource stringTextConverter}}" TextWrapping="NoWrap" Margin="0" Style="{StaticResource PhoneTextExtraLargeStyle}" d:LayoutOverrides="Width"/>
                            <TextBlock Text="{Binding BigBlind}" TextWrapping="NoWrap" Margin="0" Style="{StaticResource PhoneTextExtraLargeStyle}" d:LayoutOverrides="Width"/>
                        </StackPanel>
                        <TextBlock x:Name="txtbreak" Text="break" TextWrapping="NoWrap" Margin="0,0,0,23" Style="{StaticResource PhoneTextExtraLargeStyle}" d:LayoutOverrides="Width, Height" Visibility="{Binding IsBreak, ConverterParameter=false, Converter={StaticResource boolToVisibility}}" Foreground="{StaticResource PhoneAccentBrush}" />
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,23" VerticalAlignment="Bottom" d:LayoutOverrides="Width">
                            <TextBlock Text="{Binding MinutesPerBlind, ConverterParameter=\{0\} minutes, Converter={StaticResource stringTextConverter}}" TextWrapping="NoWrap" Margin="0" Style="{StaticResource PhoneTextSubtleStyle}" d:LayoutOverrides="Width"/>
                            <TextBlock Text="{Binding Ante, ConverterParameter=\, \{0\} ante, Converter={StaticResource stringTextConverter}}" TextWrapping="NoWrap" Margin="0" Style="{StaticResource PhoneTextSubtleStyle}" d:LayoutOverrides="Width" Visibility="{Binding Ante, ConverterParameter=0, Converter={StaticResource valueToVisibility}}"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

Some more info: I copied and pasted the exact XAML from the WindowsPhoneDataBoundApp (which works) into my usercontrol so that it now looks like this:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <ListBox x:Name="listBoxBlinds" Margin="0,0,-12,0" ItemsSource="{Binding BlindSet.Blinds}" SelectionChanged="MainListBox_SelectionChanged">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Margin="0,0,0,17" Width="432">
                    <TextBlock Text="{Binding LevelNumber}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                    <TextBlock Text="{Binding SmallBlind}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>

and it does not work… so is it something to do with the PivotItem?
Update: I took this code out of the PivotItem and it works fine.. so any ideas how to get it working in a pivotitem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:06:37+00:00Added an answer on May 24, 2026 at 3:06 am

    I needed this exact thing and ended up just binding the HEIGHT of the listbox to the ACTUALHEIGHT of the stackpanel that contains it.

    So you might have

    <controls:PivotItem Header="Destinations" Margin="0,0,12,0" Name="pvtItemDestinations">
        <StackPanel Name="stkDestinations">
            <ListBox Name="lstDestinations" 
                     HorizontalContentAlignment="Stretch" 
                     Height="{Binding ElementName=stkDestinations, Path=ActualHeight, Mode=OneWay}">
                <ListBox.ItemTemplate>
                    ...
                    xaml continues
                    ...
                </ListBox.ItemTemplate>
            </ListBox>
        </StackPanel>
    </controls:PivotItem>
    

    Then, make sure the stackpanel is set to automatically fill whatever space it’s in and presto, the listbox will resize to the size of it’s stackpanel container, and the scrolling logic will kick in properly.

    Note that this mainly applies when your itemtemplate ends up defining items that can vary in height. If they’re all the same height, it’s usually not a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this is simple but it's driving me nuts. I have a ListBox
I'm trying to use a Thread in a simple winform. I have a ListBox
I have a pretty simple form with a listbox, a text box, and two
I have a simple Windows Forms application which binds a DataView to a ListBox.
I have a simple aspx page with a textbox, linkbutton and listbox. The listbox
I have simple SL user control. A listbox which shows all customers and on
I have a Form with only a simple listbox. The listbox is Full-docked and
I have a simple listbox with extended selection mode. Selection works almost perfectly fine
I have a simple ListBox.ItemTemplate containing a Label and a TextBox bound to a
My problem is rather simple. I have a ListBox, containing Thumnails (Image) <ListBox Name=ListBox_Thumbnails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.