我有一个WP7项目,现在已经给了我很多天的解决方案。任何帮助整理这个将非常感激。
基本上,我有一个ScrollViewer。在里面,我有一个ItemsControl。 ItemsControl的ItemTemplate包含一个Expander(改编自Silverlight 3 Toolkit)。 Expander ContentTemplate有一个ItemsControl。
基本上,正在发生的事情是,当我展开其中一个Expander项目并且ItemsControl包含更多项目(> 25)时,列表的“呈现”似乎被截断。项目应该有一个很大的空白空间,因此似乎有空间为他们保留,但尽可能尝试,他们只是被截断。
我尝试过三种不同类型的Expander控件,包括ExpanderView。无论我尝试什么,结果都相同。
以下是截图:http://www.IntuitiveWebDesigns.com/Photos/truncation.png
以下是我正在使用的XAML的片段。
<ScrollViewer Grid.Row="1">
<ItemsControl ItemsSource="{Binding Publishers}" Margin="0,10,0,0" Height="Auto">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="Black" Opacity="60" OpacityMask="#8A000000" CornerRadius="10">
<controlToolkit:Expander ExpandDirection="Down" Header="{Binding}" Content="{Binding}" Height="Auto">
<controlToolkit:Expander.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding PublisherName}"
Foreground="{StaticResource PhoneAccentBrush}"
FontSize="{StaticResource PhoneFontSizeExtraLarge}"
FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>
</DataTemplate>
</controlToolkit:Expander.HeaderTemplate>
<controlToolkit:Expander.ContentTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding Issues}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding TitleAndIssue}"
Foreground="{StaticResource PhoneForegroundBrush}"
FontSize="{StaticResource PhoneFontSizeNormal}"
FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>
<TextBlock Text="{Binding StrAmount}"
TextWrapping="Wrap"
Margin="0,0,0,0"
Foreground="{StaticResource PhoneAccentBrush}"
FontSize="{StaticResource PhoneFontSizeNormal}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</controlToolkit:Expander.ContentTemplate>
</controlToolkit:Expander>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
答案 0 :(得分:0)
你正在达到平台的限制。具体而言,UIElement在任一维度上都不能大于2048px。出于内存和性能原因,存在此限制。
尝试使用其中一种标准或phone version of the toolkit中的一种,而不是构建自己的控件。
如果您确实想使用扩展器样式控件,请为可滚动区域保留较小的固定大小,并虚拟化显示的列表。