Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.0 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Build a Standard UI Dialog Box by Using Grid 03/30/2017
csharp
vb
dialog boxes [WPF], creating
Grid control [WPF], creating [WPF], dialog box
d6ac3d51-844b-4d29-96d8-81a696a7b960

How to: Build a Standard UI Dialog Box by Using Grid

This example shows how to create a standard [!INCLUDETLA#tla_ui] dialog box by using the xref:System.Windows.Controls.Grid element.

Example

The following example creates a dialog box like the Run dialog box in the Windows operating system.

The example creates a xref:System.Windows.Controls.Grid and uses the xref:System.Windows.Controls.ColumnDefinition and xref:System.Windows.Controls.RowDefinition classes to define five columns and four rows.

The example then adds and positions an xref:System.Windows.Controls.Image, RunIcon.png, to represent the image that is found in the dialog box. The image is placed in the first column and row of the xref:System.Windows.Controls.Grid (the upper-left corner).

Next, the example adds a xref:System.Windows.Controls.TextBlock element to the first column, which spans the remaining columns of the first row. It adds another xref:System.Windows.Controls.TextBlock element to the second row in the first column, to represent the Open text box. A xref:System.Windows.Controls.TextBlock follows, which represents the data entry area.

Finally, the example adds three xref:System.Windows.Controls.Button elements to the final row, which represent the OK, Cancel, and Browse events.

[!code-csharpGridRunDialog#1] [!code-vbGridRunDialog#1]

See also