Xaml groupped GridView中的文本框大小不正确
我试图在Windows 8应用程序中使用groupped GridView,但我遇到了一个非常大的项目问题 有了这个小例子,就更容易理解了:Xaml groupped GridView中的文本框大小不正确,xaml,windows-8,Xaml,Windows 8,我试图在Windows 8应用程序中使用groupped GridView,但我遇到了一个非常大的项目问题 有了这个小例子,就更容易理解了: <Page x:Class="TestGridView.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x
<Page
x:Class="TestGridView.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestGridView"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<CollectionViewSource
x:Name="groupedItemsViewSource"
IsSourceGrouped="true" />
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<GridView
x:Name="itemGridView"
ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}" FontSize="26" Margin="20" />
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate />
</GroupStyle.HeaderTemplate>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Vertical"/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</GridView.GroupStyle>
</GridView>
</Grid>
</Page>
和代码隐藏:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
List<Value> list = new List<Value>
{
new Value { Text = "A11111"},
new Value { Text = "A22222"},
new Value { Text = "A333333333333333333333333333333333333#"},
new Value { Text = "BBBBB"},
new Value { Text = "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC#"},
new Value { Text = "DDDDD"},
new Value { Text = "DDDDD"},
};
IEnumerable<List<Value>> values = from v in list
group v by v.Text[0].ToString() into p
orderby p.Key
select new List<Value>(p);
groupedItemsViewSource.Source = values;
}
}
public class Value
{
public string Text { get; set; }
}
问题是A333333333333333333333333333333333值被截断,尽管CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
如何在gridview上显示所有内容
提前感谢您的帮助。
谨向您致意,感谢您提供了足够的、格式良好的代码