1. quanlich's Avatar
    Hi,

    I have a problem with adding a Search - textbox in writing a pivot app.
    You can see in the image below, I can not scroll items after adding a textbox to the pivot.

    sans-titre.png

    The code .xaml for the second case:
    Code:
    <phone:PivotItem Header="Tất cả"
                                 >
                    <ScrollViewer>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="80" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ListBox Margin="0,0,-12,0"
                                     x:Name="list1"
                                     ItemsSource="{Binding AllSongs.Items}"
                                     ItemTemplate="{StaticResource ListTitleTemplate}"
                                     Grid.Row="1">
                            </ListBox>
                            <toolkit:PhoneTextBox Hint="Search"
                                                  TextChanged="SearchBox_TextChanged"
                                                  Name="SearchBox"
                                                  Grid.Row="0" />
                        </Grid>
                    </ScrollViewer>
                    
    
                </phone:PivotItem>
    I tried StackPanel and Grid but they weren't better. Could you please give me some solutions?

    Thanks in advance.
    02-20-2014 12:26 PM
  2. Catholic Tech Geek's Avatar
    Your problem is with the row definitions. Stick with the Grid and you don't need the ScrollViewer. For what you want, instead of "auto", you want to use "*" instead. The "*" symbol tells the XAML parser to stretch the component to fill the remaining space after all items with a value of "auto" or a fixed value.

    Code:
    <phone:PivotItem Header="Tất cả">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="80" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <toolkit:PhoneTextBox Hint="Search"
                                    TextChanged="SearchBox_TextChanged"
                                    Name="SearchBox"
                                    Grid.Row="0" />
            <ListBox Margin="0,0,-12,0"
                                    x:Name="list1"
                                    ItemsSource="{Binding AllSongs.Items}"
                                    ItemTemplate="{StaticResource ListTitleTemplate}"
                                    Grid.Row="1">
            </ListBox>
        </Grid>
    </phone:PivotItem>
    I hope this helps. In my solution, notice that I switched the order of the PhoneTextBox and the ListBox. I didn't have to, but I find that it's better organization if you put your XAML in full visual order (as in the order you would see everything if everything was visible at one time).
    quanlich likes this.
    02-22-2014 04:56 PM

Similar Threads

  1. Heading to Verizon today after work to get the Icon
    By radmanvr in forum Nokia Lumia Icon
    Replies: 68
    Last Post: 02-26-2014, 12:38 PM
  2. Google *tried* to buy WhatsApp
    By Jas00555 in forum The "Off Topic" Lounge
    Replies: 3
    Last Post: 02-21-2014, 10:40 AM
  3. How to access internet on a WP8 on Hyper-V?
    By Ma Rio in forum Developers Corner
    Replies: 0
    Last Post: 02-20-2014, 10:33 AM
  4. Nokia shows how to create amazing light paintings with Nokia Camera
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 02-20-2014, 10:30 AM
  5. Windows Weekly 350 OneDrive to Rule Them All
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 02-20-2014, 10:00 AM
LINK TO POST COPIED TO CLIPBOARD