如何使用从winrt :: observable_vector_base创建的自定义集合

时间:2018-11-16 12:09:39

标签: uwp c++-winrt

在我的C ++ / WinRT项目中,我尝试使用在此处创建的示例矢量:https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/collections

struct MyObservableVector :
    implements<MyObservableVector, IObservableVector<float>, IVector<float>, IVectorView<float>, IIterable<float>>,
    winrt::observable_vector_base<MyObservableVector, float>
{
    auto& get_container() const noexcept
    {
        return m_values;
    }

    auto& get_container() noexcept
    {
        return m_values;
    }

private:
    std::vector<float> m_values{ 0.1f, 0.2f, 0.3f };
};

例如,有人将如何在PhotoEditor演示应用程序中使用此向量? (https://github.com/Microsoft/Windows-appsample-photo-editor

假设您要将其声明为Photo.idl Photo.h Photo.cpp ViewModel的一部分?

0 个答案:

没有答案