From the course: XAML Fundamentals: Building Powerful UIs for Cross-Platform Applications

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Attached properties with the Grid

Attached properties with the Grid

- I think the most common example you see when you're learning about attached properties is working with the panels. And we've already looked at the DockPanel, and so it has a Dock property. The canvas has a top property. And the grid also has some attached properties, which you'll look at in this video. So the way this is set up is I have a <Grid> with three columns and three rows. You set those up in the <Grid> with something called the <Grid.RowDefinitions> and the <Grid.ColumnDefinitions>. So what this is specifying is the width of each of the three columns. You can think of this as a percent, 30% is the width of the first column, 40% for the middle column, and 30%. Same with the rows. And then, I put this ellipse here, and I didn't specify any column or any row. So it goes in column zero, row zero. And then the way we can change that, of course, is to go here and use an attached property. It's called Grid.…

Contents