WPF – Column and Row Definitions

Leave a comment

In a WPF grid, we can define columns and rows. To do this, create a new WPF app in Visual Studio:

You will see below:

Select Layout in Properties. You will see Column Definitions and Row Definitions:

Select Column Definitions. Click Add:

Here you can add a column definition, which is defining a column, just as you would in a table for example:

Add a second column definition:

You will see in the XAML we have a ColumnDefinitions collection containing 2 ColumnDefinitions:

Let’s remove the column definition and add 3 row definitions. You will see:

If we use the Column and Row Definitions together, you can see we can build a grid that holds labels and textboxes for user input:

Looking at this, we have:

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

See more articles on: WPF

Leave a Reply

Your email address will not be published. Required fields are marked *