--- title: "How to: Get or Set a Dock Value" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "Dock values [WPF], setting" - "Dock values [WPF], getting" ms.assetid: fcf4ab8a-c7cd-4835-8d04-de1c999ab4a8 --- # How to: Get or Set a Dock Value The following example shows how to assign a value for an object. The example uses the and methods of . ## Example The example creates an instance of the element, `txt1`, and assigns a value of `Top` by using the method of . It then appends the value of the property to the of the element by using the method. Finally, the example adds the element to the parent , `dp1`. [!code-csharp[DockPanelSetDock#1](~/samples/snippets/csharp/VS_Snippets_Wpf/DockPanelSetDock/CSharp/DockPanel_SetDock.cs#1)] [!code-vb[DockPanelSetDock#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/DockPanelSetDock/VisualBasic/DockPanel_SetDock.vb#1)] ## See also - - - - [Panels Overview](panels-overview.md)