You can see the MS sample Photo Editor C++/WinRT sample application which uses GridView and other controls
But it is complicated
It is a lot simpler to do it in C#, by copying/adapting code from XAML Controls Gallery or any MSDN sample (most of them are in C#)
WinUI Gridview within MainWindow
youki
996
Reputation points
Hello,
I try to start with c++ and also with WinUI. I've never worked with XAML before. I already have the XAML Controls Gallery and tried a few examples on MSDN.
I want to add a gridview (each row under each other) and try to add the rows.
I tried a few examples but i can't figure it out, how to start and what to take.
- Should i use a binding or add it programmatically? (I want the ability to add and delete rows)
- I have a menu bar on top and i also want to add an other gridview later, so i use a grid as a container for all?
- I think i will load the data from a XML to a vector of objects and then try to get it to the grid?
- What is the simplest (and best) solution for getting it done within the MainWindow, any links or code please to get into it?!
class MyObject<Grid > <muxc:MenuBar VerticalAlignment="Top"> <muxc:MenuBarItem Title="1"/> <muxc:MenuBarItem Title="2"/> <muxc:MenuBarItem Title="3"/> <muxc:MenuBarItem Title="4"/> <muxc:MenuBarItem Title="5"/> <muxc:MenuBarItem Title="6"/> </muxc:MenuBar> <TextBox x:Name="tbTest" HorizontalAlignment="Center" VerticalAlignment="Center" Text="test"></TextBox> </Grid>
{
public:
string name;
string description;
}; MainWindow::MainWindow()
{
InitializeComponent(); vector<MyObject> test; MyObject c;
c.name = "Rick";
c.description = "Man"; test.push_back(c); c.name = "Diana";
c.description = "Woman"; test.push_back(c); } Regards
Accepted answer
-
Castorix31 81,636 Reputation points
2022-03-06T16:36:04.777+00:00