Grid view in C++
Can someone explain how to add UserControl to grid in C++?
I have some code:
And it throw error: Elements is protected by method AddVisualChild.
I made something like this in c# in the past, but dont remember exactly how.
How to do this? I want to generate content in grid.
I have some code:
Code: Select all
contentGrid = FindName<Noesis::Grid>("TestGrid");
UserControl* userControl = new TabControlMenu();
contentGrid->AddVisualChild(userControl);
I made something like this in c# in the past, but dont remember exactly how.
How to do this? I want to generate content in grid.
Re: Grid view in C++
Being Grid a Panel, you need to use its Children Property:
And in case you need to set row and column:
Please, note that the way you were creating your control is not correct and will leak memory. Make sure to read our C++ Architecture Guide.
Code: Select all
Ptr<UserControl> userControl = MakePtr<TabControlMenu>();
grid->GetChildren()->Add(userControl);
Code: Select all
Grid::SetColumn(userControl, x);
Grid::SetRow(userControl, y);
Re: Grid view in C++
Thanks for reply, I have the compiler error, it throws: Pointer to uncomplited type is not allowed.Being Grid a Panel, you need to use its Children Property:And in case you need to set row and column:Code: Select allPtr<UserControl> userControl = MakePtr<TabControlMenu>(); grid->GetChildren()->Add(userControl);
Please, note that the way you were creating your control is not correct and will leak memory. Make sure to read our C++ Architecture Guide.Code: Select allGrid::SetColumn(userControl, x); Grid::SetRow(userControl, y);
It throws on my grid pointer.
My grid pointer is Grid* type
Re: Grid view in C++
Ok I needed include UIElementCollection header :)
Re: Grid view in C++
Yes, make sure you are including the corresponding headers or just use the PCH header that includes everything.
Who is online
Users browsing this forum: No registered users and 16 guests