Note that there are some explanatory texts on larger screens.

plurals
  1. PONot able to scroll the listbox in WP7
    text
    copied!<p>I have a listbox control where items are added using a user control having a textblock and image.</p> <pre><code>&lt;UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" d:DesignHeight="52" d:DesignWidth="480"&gt; &lt;Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}"&gt; &lt;TextBlock Height="30" HorizontalAlignment="Left" Margin="12,10,0,0" Name="Index_itemtext" Text="" VerticalAlignment="Top" Width="145" /&gt; &lt;Image Height="34" HorizontalAlignment="Right" Margin="0,6,55,0" Source="blue_triangle.png" Name="IndexList_itemImage" Stretch="Uniform" VerticalAlignment="Top" Width="66" /&gt; &lt;Line Height="10" HorizontalAlignment="Left" Margin="0,38,0,0" Name="seperator_line" Stroke="White" StrokeThickness="2" VerticalAlignment="Top" Width="480" Stretch="Fill" Fill="#FFF5E9E9" /&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>And the list box xaml:</p> <pre><code> &lt;Grid x:Name="LayoutRoot" Background="Transparent"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="768"/&gt; &lt;RowDefinition Height="0*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid Opacity="5" VerticalAlignment="Top" Grid.Row="0"&gt; &lt;Grid.Background&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FF282828" Offset="0.366" /&gt; &lt;GradientStop Color="#FE848484" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Grid.Background&gt; &lt;Button Content="Top" Grid.Column="0" HorizontalAlignment="Left" Grid.Row="0" VerticalAlignment="Top" Height="72" Name="Top_btn" Width="114" BorderBrush="{x:Null}" Click="topbutton_Click" Style="{StaticResource ButtonStyle1}" &gt; &lt;Button.Background&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FF908585" Offset="0.11" /&gt; &lt;GradientStop Color="#FF342E2E" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Button.Background&gt; &lt;/Button&gt; &lt;Button Content="Back" Height="72" Grid.Column="1" Grid.Row="0" Name="Back_btn" Width="104" HorizontalAlignment="Right" HorizontalContentAlignment="Center" Margin="0" BorderBrush="{x:Null}" Click="backbutton_Click" Style="{StaticResource ButtonStyle1}" &gt; &lt;Button.Background&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FF908585" Offset="0.11" /&gt; &lt;GradientStop Color="#FF342E2E" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Button.Background&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;ListBox Name="Index_list" ScrollViewer.VerticalScrollBarVisibility="Visible" VerticalContentAlignment="Top" SelectionChanged="on_selection" Margin="0,78,0,0" Height="Auto"&gt; &lt;ListBoxItem Style="{StaticResource ListBoxItemStyle}"&gt; &lt;/ListBoxItem&gt; &lt;/ListBox&gt; &lt;/Grid&gt; </code></pre> <p>Now when i add the items to the list ,the vertical scroll does not go till the last item/bottom of list box not reachable i.e. it comes back to first row which stops from last item selection:</p> <pre><code> for (int i = 0; i &lt; gridSize; i++) { listbox_item list_item = new listbox_item(); list_item.Index_itemtext.FontSize = 25; list_item.Index_itemtext.Text = index[i]; list_item.IndexList_itemImage.Source = new BitmapImage(new Uri("some.png", UriKind.Relative)); list_item.seperator_line.StrokeThickness = 5; list_item.Margin = new Thickness(0, 0, 0, 5); Index_list.Items.Add(list_item); } </code></pre> <p>Also the list row does not occupy the width of device in landscape mode,whereas the requirement is that the row item widens as the device width changes.Can someone help with these problems?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload