mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-10 16:06:08 +02:00
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
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: "How to: Create a Grid Element"
|
||||
ms.date: "03/30/2017"
|
||||
dev_langs:
|
||||
- "csharp"
|
||||
- "vb"
|
||||
helpviewer_keywords:
|
||||
- "Grid control [WPF], creating [WPF], grid instance"
|
||||
ms.assetid: b2f07626-9df8-43b8-8d36-492f3cb42837
|
||||
---
|
||||
# How to: Create a Grid Element
|
||||
## Example
|
||||
The following example shows how to create and use an instance of <xref:System.Windows.Controls.Grid> by using either [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] or code. This example uses three <xref:System.Windows.Controls.ColumnDefinition> objects and three <xref:System.Windows.Controls.RowDefinition> objects to create a grid that has nine cells, such as in a worksheet. Each cell contains a <xref:System.Windows.Controls.TextBlock> element that represents data, and the top row contains a <xref:System.Windows.Controls.TextBlock> with the <xref:System.Windows.Controls.Grid.ColumnSpan%2A> property applied. To show the boundaries of each cell, the <xref:System.Windows.Controls.Grid.ShowGridLines%2A> property is enabled.
|
||||
|
||||
[!code-csharp[Grid#3](~/samples/snippets/csharp/VS_Snippets_Wpf/Grid/CSharp/Grid_Code.cs#3)]
|
||||
[!code-vb[Grid#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/Grid/VisualBasic/grid_vb.vb#3)]
|
||||
[!code-xaml[Grid#3](~/samples/snippets/xaml/VS_Snippets_Wpf/Grid/XAML/default.xaml#3)]
|
||||
|
||||
Either approach will generate a user interface that looks much the same, like the one below.
|
||||
|
||||

|
||||
## See also
|
||||
|
||||
- <xref:System.Windows.Controls.Grid>
|
||||
- [Panels Overview](panels-overview.md)
|
||||
Reference in New Issue
Block a user