Windows Phone: How to put another control at the bottom of a dynamic listbox
I have a listbox that is showing a dynamic list of data that can grow. At the bottom of this listobx, once the user has scrolled through all the items, I want to show a piece of text. And sometimes, depending on the situation, it can be a button or another listbox. But, I want to learn how to put a textbox first. I tried searching forums and tried, Grid, StackPanel, ScrollViewer. Nothing seems to work. This code here, looks promising but I am not able to scroll with this: This must be a common UI, I would guess. Any help?
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="tasteePic" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="I'm Hungry" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<ProgressBar Height="4" HorizontalAlignment="Left" Margin="10,10,0,0" Name="progressBar1" VerticalAlignment="Top" Width="460" />
</StackPanel>
<ScrollViewer Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
<StackPanel Margin="12,17,0,28">
<ListBox Name="MenuItemListBox" VerticalA开发者_StackOverflow中文版lignment="Top" SelectionChanged="MenuItemListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image
Margin="4, 4, 4, 4"
Grid.Column="0"
delay:LowProfileImageLoader.UriSource="{Binding ThumbNailUrl}" />
<StackPanel>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="{Binding BusinessName}" />
<TextBlock Text="{Binding Price}" />
<TextBlock Text="{Binding Neighborhood}" />
<TextBlock Text="{Binding City}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="Test" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
</ScrollViewer>
</Grid>
You can place your TextBox after the ItemsPresenter element of the ListBox by retemplating in Blend.
Here's a worked example.
How to add a Control at the end of Items of a ListBox (e.g. a "Load More" Button or Hyperlink)?
精彩评论