【问题标题】:Grouped CollectionViewSource in windows 8 metro applicationWindows 8 Metro 应用程序中的分组 CollectionViewSource
【发布时间】:2014-03-18 14:49:43
【问题描述】:

是否可以在我的 Metro 应用程序的 XAML 代码中将 CollectionViewSource 元素指定为

<CollectionViewSource x:Name="groupedAppointments" IsSourceGrouped="True"
                      d:Source="{Binding Appointments,
                    Source={d:DesignInstance Type=dataModel:SampleDataSource,
                    IsDesignTimeCreatable=True}}">
    <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="@DateOfVisit" />
      </CollectionViewSource.GroupDescriptions>
</CollectionViewSource>

但是VS说

Error   3   The member "GroupDescriptions" is not recognized or is not accessible.

根据msdnCollectionViewSource 应该有这个字段。 我做错了什么?

【问题讨论】:

    标签: c# wpf windows-8 microsoft-metro winrt-xaml


    【解决方案1】:

    这是用于 winrt 的 CollectionViewSource 的文档页面:http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.collectionviewsource.aspx

    GroupDescriptions 属性在 WinRT 中不可用

    如果我没记错的话,这应该对你有用:

    <CollectionViewSource x:Name="groupedAppointments" IsSourceGrouped="True"
                          ItemsPath="ThePropertyThatIsGroupedByDateOfVisitGoesHere"
                          d:Source="{Binding Appointments,
                        Source={d:DesignInstance Type=dataModel:SampleDataSource,
                        IsDesignTimeCreatable=True}}">   
    </CollectionViewSource>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-29
      • 2012-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-03
      • 1970-01-01
      相关资源
      最近更新 更多