Silverlight:页面外的内容
我正在使用Silverlight为WP7构建一个应用程序。我在Silverlight:页面外的内容,silverlight,windows-phone-7,Silverlight,Windows Phone 7,我正在使用Silverlight为WP7构建一个应用程序。我在数据透视项中有一个列表框,其中包含一些内容。我希望列表框滚动显示所有内容。不幸的是,用户不能一直向下滚动-最后的项目被切断 以下是XAML: <controls:Pivot Title="SECTIONS" x:Name="pivotControl" ItemsSource="{Binding SectionViewModels}"> <controls:Pivot.HeaderTemplat
数据透视项中有一个列表框
,其中包含一些内容。我希望列表框
滚动显示所有内容。不幸的是,用户不能一直向下滚动-最后的项目被切断
以下是XAML:
<controls:Pivot Title="SECTIONS" x:Name="pivotControl" ItemsSource="{Binding SectionViewModels}">
<controls:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DisplayName}" />
</DataTemplate>
</controls:Pivot.HeaderTemplate>
<controls:Pivot.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Style="{StaticResource disabledText}" Visibility="{Binding NoStoryContent}">
Content could not be downloaded from MySite.com. Do you have a network connection?
</TextBlock>
<!-- fake data to demonstrate -->
<ListBox FontSize="100">
<ListBoxItem Content="A" />
<ListBoxItem Content="B" />
<ListBoxItem Content="C" />
<ListBoxItem Content="D" />
<ListBoxItem Content="E" />
<!-- the user can scroll no lower than the top half of the 'F' -->
<ListBoxItem Content="F" />
<ListBoxItem Content="G" />
</ListBox>
</StackPanel>
</DataTemplate>
</controls:Pivot.ItemTemplate>
</controls:Pivot>
无法从MySite.com下载内容。你有网络连接吗?
除了滚动问题外,此控件的所有其他功能看起来/工作正常
我可能做错了什么
更新:如果我明确指定高度,效果很好。我没有使用pivot控件,所以我不确定这是否是您需要的,但我会先尝试包含列表框的ScrollViewer。我没有使用pivot控件,所以我不确定这是否是您需要的,但是我会先尝试包含列表框的ScrollViewer。问题是,当您应该使用网格时,您正在使用堆栈面板
<controls:Pivot.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Style="{StaticResource disabledText}" Visibility="{Binding NoStoryContent}">
Content could not be downloaded from MySite.com. Do you have a network connection?
</TextBlock>
<!-- fake data to demonstrate -->
<ListBox FontSize="100">
<ListBoxItem Content="A" />
<ListBoxItem Content="B" />
<ListBoxItem Content="C" />
<ListBoxItem Content="D" />
<ListBoxItem Content="E" />
<!-- the user can scroll no lower than the top half of the 'F' -->
<ListBoxItem Content="F" />
<ListBoxItem Content="G" />
</ListBox>
</Grid>
</DataTemplate>
</controls:Pivot.ItemTemplate>
无法从MySite.com下载内容。你有网络连接吗?
现在它会按预期滚动。问题是,当您应该使用网格时,您正在使用堆栈面板
<controls:Pivot.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Style="{StaticResource disabledText}" Visibility="{Binding NoStoryContent}">
Content could not be downloaded from MySite.com. Do you have a network connection?
</TextBlock>
<!-- fake data to demonstrate -->
<ListBox FontSize="100">
<ListBoxItem Content="A" />
<ListBoxItem Content="B" />
<ListBoxItem Content="C" />
<ListBoxItem Content="D" />
<ListBoxItem Content="E" />
<!-- the user can scroll no lower than the top half of the 'F' -->
<ListBoxItem Content="F" />
<ListBoxItem Content="G" />
</ListBox>
</Grid>
</DataTemplate>
</controls:Pivot.ItemTemplate>
无法从MySite.com下载内容。你有网络连接吗?
现在它按预期滚动。您看过scrollviewer()和这个问题()了吗?您看过scrollviewer()和这个问题()了吗ListBox已经是一个在ScrollViewer中显示其内容的列表框。ListBox已经是一个在ScrollViewer中显示其内容的列表框。为什么网格
在这方面的行为与堆栈面板
不同?但是堆栈面板
不注意其将增长方向上的可用大小它的内容要大。当列表框要求首选高度时,StackPanel
只给出它要求的高度。StackPanel不关心它的底部不可见,因此ListBox的底部不可见。另一方面,Grid
将尽最大努力将其内容保持在容器给定的大小内。为什么Grid
在这方面的行为与StackPanel
不同?然而,StackPanel
不注意其将增长方向上的可用大小它的内容要大。当列表框要求首选高度时,StackPanel
只给出它要求的高度。StackPanel不关心它的底部不可见,因此ListBox的底部不可见。另一方面,网格
将尽最大努力将其内容保持在容器给定的大小内。