* 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
2.3 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Share Sizing Properties Between Grids | 03/30/2017 |
|
|
a0535a6f-ff04-4b25-9912-7dd856e11044 |
How to: Share Sizing Properties Between Grids
This example shows how to share the sizing data of columns and rows between xref:System.Windows.Controls.Grid elements in order to keep sizing consistent.
Example
The following example introduces two xref:System.Windows.Controls.Grid elements as child elements of a parent xref:System.Windows.Controls.DockPanel. The xref:System.Windows.Controls.Grid.IsSharedSizeScope%2A attached property of xref:System.Windows.Controls.Grid is defined on the parent xref:System.Windows.Controls.DockPanel.
The example manipulates the property value by using two xref:System.Windows.Controls.Button elements; each element represents one of the Boolean property values. When the xref:System.Windows.Controls.Grid.IsSharedSizeScope%2A property value is set to true, each column or row member of a xref:System.Windows.Controls.DefinitionBase.SharedSizeGroup%2A shares sizing information, regardless of the content of a row or column.
[!code-xamlgridIssharedsizescopeProp#1]
...
[!code-xamlgridIssharedsizescopeProp#2]
The following code-behind example handles the methods that the button xref:System.Windows.Controls.Primitives.ButtonBase.Click event raises. The example writes the results of these method calls to xref:System.Windows.Controls.TextBlock elements that use related get methods to output the new property values as strings.
[!code-csharpgridIssharedsizescopeProp#3] [!code-vbgridIssharedsizescopeProp#3]