ためItemSourceを実装する私は、すなわちIObservableVector<T>
を実装するMicrosoftのドキュメントhere次ListView
ためItemSource
として置くことができるクラスを実装しようとしたが、いつものように、ドキュメントが機能したことがないし、そもそも無C++のサンプルコードがあります。プラットフォーム:: InvalidArgumentException ^で:メインページのための私のXAMLの内容は、ちょうどが正しくリストビュー
<ListView x:Name="TestListView"/>
とソースコードアプリを実行しているとき、私はいつも
のMicrosoft C++例外を取得
public ref class MyStringSrc sealed : Windows::Foundation::Collections::IObservableVector<Platform::String^>
{
public:
// Inherited via IVector
virtual Windows::Foundation::Collections::IIterator<Platform::String ^>^First();
// Inherited via IObservableVector
virtual property unsigned int Size
{
unsigned int get()
{
return _size;
}
}
virtual Platform::String^GetAt(unsigned int index);
virtual Windows::Foundation::Collections::IVectorView<Platform::String ^>^GetView();
virtual bool IndexOf(Platform::String ^value, unsigned int *index);
virtual void SetAt(unsigned int index, Platform::String ^value);
virtual void InsertAt(unsigned int index, Platform::String ^value);
virtual void RemoveAt(unsigned int index);
virtual void Append(Platform::String ^value);
virtual void RemoveAtEnd();
virtual void Clear();
virtual unsigned int GetMany(unsigned int startIndex, Platform::WriteOnlyArray<Platform::String ^, 1U> ^items);
virtual void ReplaceAll(const Platform::Array<Platform::String ^, 1U> ^items);
virtual event Windows::Foundation::Collections::VectorChangedEventHandler<Platform::String ^>^VectorChanged;
private:
unsigned int _size = 1000;
};
public ref class MainPage sealed
{
public:
MainPage();
};
MainPage::MainPage()
{
InitializeComponent();
TestListView->ItemsSource = ref new MyStringSrc();
}
Windows::Foundation::Collections::IIterator<Platform::String ^>^MyStringSrc::First()
{
throw ref new Platform::NotImplementedException();
// TODO: insert return statement here
}
Platform::String^MyStringSrc::GetAt(unsigned int index)
{
throw ref new Platform::NotImplementedException();
// TODO: insert return statement here
}
Windows::Foundation::Collections::IVectorView<Platform::String ^>^MyStringSrc::GetView()
{
throw ref new Platform::NotImplementedException();
// TODO: insert return statement here
}
bool MyStringSrc::IndexOf(Platform::String ^value, unsigned int *index)
{
return false;
}
void MyStringSrc::SetAt(unsigned int index, Platform::String ^value)
{
throw ref new Platform::NotImplementedException();
}
void MyStringSrc::InsertAt(unsigned int index, Platform::String ^value)
{
throw ref new Platform::NotImplementedException();
}
void MyStringSrc::RemoveAt(unsigned int index)
{
throw ref new Platform::NotImplementedException();
}
void MyStringSrc::Append(Platform::String ^value)
{
throw ref new Platform::NotImplementedException();
}
void MyStringSrc::RemoveAtEnd()
{
throw ref new Platform::NotImplementedException();
}
void MyStringSrc::Clear()
{
throw ref new Platform::NotImplementedException();
}
unsigned int MyStringSrc::GetMany(unsigned int startIndex, Platform::WriteOnlyArray<Platform::String ^, 1U> ^items)
{
return 0;
}
void MyStringSrc::ReplaceAll(const Platform::Array<Platform::String ^, 1U> ^items)
{
throw ref new Platform::NotImplementedException();
}
ですメモリロケーション0x02E2DA80。 HRESULT:0x80070057パラメータが正しくありません。 WinRT information:パラメータが正しくありません。
は右の私が
TestListView->ItemsSource = ref new MyStringSrc();
を設定する行で、私は従うことができますサンプル実装はありますか?
[Vector](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh441570.aspx)のようなものを使用する代わりに、カスタムIObservableVectorクラスが特に必要ですか? –
@DecadeMoon私は実際には知りません。私は 'IObservableVector'を実装することを示唆している記事のようにインクリメンタルローディングをしようとしています。 –