--- title: "How to: Build a Standard UI Dialog Box by Using Grid" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "dialog boxes [WPF], creating" - "Grid control [WPF], creating [WPF], dialog box" ms.assetid: d6ac3d51-844b-4d29-96d8-81a696a7b960 --- # How to: Build a Standard UI Dialog Box by Using Grid This example shows how to create a standard [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)] dialog box by using the element. ## Example The following example creates a dialog box like the **Run** dialog box in the Windows operating system. The example creates a and uses the and classes to define five columns and four rows. The example then adds and positions an , `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 (the upper-left corner). Next, the example adds a element to the first column, which spans the remaining columns of the first row. It adds another element to the second row in the first column, to represent the **Open** text box. A follows, which represents the data entry area. Finally, the example adds three elements to the final row, which represent the **OK**, **Cancel**, and **Browse** events. [!code-csharp[GridRunDialog#1](~/samples/snippets/csharp/VS_Snippets_Wpf/GridRunDialog/CSharp/window1.xaml.cs#1)] [!code-vb[GridRunDialog#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/GridRunDialog/VisualBasic/grid_vb.vb#1)] ## See also - - - [Panels Overview](panels-overview.md) - [How-to Topics](grid-how-to-topics.md)