C++ ItemControl
Posted: 10 Aug 2022, 03:58
Hi, how can I add items to a ItemControl or any control derived from it in C++? I followed this C# WFP documentation: https://docs.microsoft.com/en-us/dotnet ... esktop-6.0
and also tried to only use the SetItemsSource() function
But none of them worked...
Code: Select all
Ptr<ItemsControl> pItemsControl = *new ItemsControl();
Ptr<Binding> pBinding = *new Binding();
Ptr<BaseComponent> pBoxed = Boxing::Box("FirstItem");
pBinding->SetSource(pBoxed);
pItemsControl->SetBinding(pItemsControl->ItemsSourceProperty, pBinding);
Code: Select all
Ptr<ItemsControl> pItemsControl = *new ItemsControl();
Ptr<Binding> pBinding = *new Binding();
Ptr<BaseComponent> pBoxed = Boxing::Box("FirstItem");
pItemsControl->SetItemsSource(pBoxed);