Winrt和PhotoEditor示例中的收藏范围 [英] Scope of Collections in Winrt And PhotoEditor example
问题描述
-
Winrt :: Windows :: Foundation :: Collection仅具有没有具体集合类型的接口。
Winrt::Windows::Foundation::Collection only has interfaces no concrete collection type.
I已经被告知要使用Platorm :: Collections,但是不确定如何从Winrt :: Windows :: ?????中获得该信息。我以为它只适用于C ++ / Cx
I have been told to use Platorm::Collections, but not sure how you get to that from Winrt::Windows::?????. I thought its only for C++/Cx
3。我在PhotoEditor示例中复制并使用了Observable_Vector,但构建错误,说我在vector中的类型未实现GetTrustLevel()。
3.I have copied and used the Observable_Vector in PhotoEditor sample but am getting error on build saying my type in vector does not implement GetTrustLevel().
- 如果我不能使用Platform :: Collections在WInrt中,这意味着当前只有一个示例如何在Winrt(PhotoEditor)中使用集合,这也意味着Winrt中的onyl具体集合是phtotEditor中的Observable_Vector。
需要帮助来阐明c ++-Winrt中的收集范围。
还有关于使用PhotoEditor中相同的Observable_vector时为什么获得信任级别错误的任何帮助。
Need help to clarify the scope of collection in c++-Winrt. And also any help as to why am Getting Trust level error when using same Observable_vector from PhotoEditor.
谢谢
推荐答案
通常,您不必实现自己的集合。 C ++ / WinRT提供了一组帮助器函数,用于创建各种常见的通用集合类型。例如:
In general, you should not have to implement your own collections. C++/WinRT provides a set of helper functions for creating a variety of common generic collection types. For example:
using namespace winrt;
using namespace Windows::Foundation::Collections;
int main()
{
IVector<int> a = single_threaded_vector<int>({ 1,2,3 });
IObservableMap<hstring, int> b = single_threaded_observable_map<hstring, int>();
}
还支持创建自定义集合。我在这里描述了其中一些选项:
There is also support for creating custom collections. I described some of those options here:
https://kennykerr.ca/2018/05/12/cppwinrt-creating-collections-simply-ficiently/
这篇关于Winrt和PhotoEditor示例中的收藏范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!