Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid.md
Andy (Steve) De George be103da07e Replace various WPF include files with content (#1335)
* net-current-v30plus-md.md

* net-current-v40plus-md.md

* tla2sharptla-ui-md.md

* tla2sharptla-uiautomation-md.md

* tla2sharptla-winclient-md.md

* tla2sharptla-xaml-md.md

* tlasharptla-ui-md.md

* tlasharptla-uiautomation-md.md

* tlasharptla-winclient-md.md

* tlasharptla-xaml-md.md

* fix warnings
2022-03-16 12:14:11 -04: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 user interface (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