【发布时间】:2017-02-26 18:49:24
【问题描述】:
我试图将 Platform::Collections::Vector 绑定到 GridView,但 Visual Studio 出现编译时错误:
C3986 'get':the signature of the public member contains a native type 'std::equal_to<T>'
C3986 'get':the signature of the public member contains a native type 'std::equal_to<T>'
C3986 'get':the signature of the public member contains a native type 'std::equal_to<T>'
C3986 'get':the signature of the public member contains a native type 'std::equal_to<T>'
NavigationPage.xaml.h
[Windows::Foundation::Metadata::WebHostHidden]
public ref class NavigationPage sealed
{
public:
NavigationPage();
property Platform::Collections::Vector<Platform::String^>^ ImagesProperty
{
Platform::Collections::Vector<Platform::String^>^ get()
{
if (Images == nullptr) Images = ref new Platform::Collections::Vector<Platform::String^>();
return this->Images;
};
}
private:
Platform::Collections::Vector<Platform::String^>^ Images;
};
NavigationPage.xaml
<GridView Grid.Row="1" x:Name="View" ItemSource="{x:Bind ImagesProperty}">
<GridView.ItemTemplate>
<DataTemplate>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
我已经尝试在 Google 上搜索,但我发现的大多数示例都是用 C# 制作的,如果对于 c++,它们的目标是 Windows 8/8.1,所以作为最后一个资源,我决定在这里询问。
目标构建:10586,最小构建:10586
【问题讨论】:
-
这是否解决了问题? stackoverflow.com/a/11770357/424129
-
好吧,我在实现 Windows::Foundation::Collections::IVector 时遇到了麻烦,但是根据你的回答,我可以假设其余代码在语法上没问题吗?
-
我对 C++ 太生疏了,无法对此发表评论。
-
问题已解决,感谢您的帮助:D
-
除非此问题与 EdPlunkett 链接的问题重复,否则您应该添加答案(有关更多信息,请参阅 Can I answer my own question?)。
标签: xaml data-binding collections uwp c++-cx