{"id":573,"date":"2011-04-21T05:21:00","date_gmt":"2011-04-21T05:21:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2011\/04\/21\/silverlight-4-firestarter-series-3-how-to-work-with-panels-xaml-and-controls-in-silverlight\/"},"modified":"2024-07-05T12:39:57","modified_gmt":"2024-07-05T19:39:57","slug":"silverlight-4-firestarter-series-3-how-to-work-with-panels-xaml-and-controls-in-silverlight","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/silverlight-4-firestarter-series-3-how-to-work-with-panels-xaml-and-controls-in-silverlight\/","title":{"rendered":"Silverlight 4 Firestarter Series #3: How to work with Panels, XAML, and Controls in Silverlight"},"content":{"rendered":"<p><span style=\"font-size: small\">I am back with details on how to work with Panels, XAML, and Controls in Silverlight. In this walkthrough, we will see how to work with Panels, XAML, and Controls to create a Data-Driven Silverlight Interface. <\/span><\/p>\n<p><span style=\"font-size: small\">During this walkthrough we will cover the following topics: <\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">How to use the Visual Studio 2010 Silverlight Designer, Cider <\/span><\/li>\n<li><span style=\"font-size: small\">How to work with XAML, Panels, and Controls <\/span><\/li>\n<li><span style=\"font-size: small\">The difference between a Grid and a StackPanel <\/span><\/li>\n<li><span style=\"font-size: small\">How to add controls and XML Namespaces <\/span><\/li>\n<li><span style=\"font-size: small\">How to create a UserControl <\/span><\/li>\n<\/ol>\n<p><i><span style=\"font-size: small\">Before you begin, you need to download the <\/span><\/i><a href=\"http:\/\/www.silverlight.net\/news\/events\/firestarter-labs\/\"><i><span style=\"font-size: small\">offline kit<\/span><\/i><\/a><i><span style=\"font-size: small\"> from the Firestarter Labs to use the existing applications.<\/span><\/i><\/p>\n<p><span style=\"font-size: small\">To work with Panels, XAML, and Controls follow these three simple steps:<\/span><\/p>\n<p><span style=\"font-size: small\">Step 1: Create a Data-Driven Interface <br \/>Step 2: Create a Form Entry to edit the Interface Details <br \/>Step 3: Add a Menu using the StackPanel<\/span><\/p>\n<h3><b>Step 1: Create a Data-Driven Interface<\/b><\/h3>\n<p><span style=\"font-size: small\">In this step, we will see how to work with XAML, work with controls by adding a DataGrid, and work with the visual editor, known as the Cider editor, in Visual Studio. To create a Data-Driven Interface, follow these steps:<\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">Open Visual Studio 2010, and from the File menu, select Open Project. The Open Project dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Open the following Visual Studio Solution file from the downloaded offline kit: <br \/>&ldquo;FirestarterLabs\u00003 &#8211; XAML and ControlsSourceStarting PointVB PanelsControlsLab.sln&rdquo; <\/span><\/li>\n<li><span style=\"font-size: small\">Open the MainPage.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">To define rows in the grid, add the following XAML code in the &ldquo;LayoutRoot&rdquo; grid tag: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;LayoutRoot&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Background<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;White&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"line-height: 115%;font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"line-height: 115%;font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"line-height: 115%;font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"line-height: 115%;font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">To add an application title, add a TextBlock control to the design view. <\/span><\/li>\n<li><span style=\"font-size: small\">Specify the row placement by using the Grid.Row attribute inside the TextBlock tag, as shown in the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;LayoutRoot&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Background<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;White&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span>&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Row<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0&#8243;&gt;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Contact Details<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span>&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<p><i>Note: The rows are indexed from the top of the panel to the bottom, beginning with zero.<\/i> <\/span><\/li>\n<li><span style=\"font-size: small\">Drag and drop the DataGrid control from the Toolbox onto the design view below the header. <br \/><i>Note: An xmlns (XML Namespace) declaration is automatically added in the XAML code. This addition is necessary if you want to use the DataGrid because it is part of the Silverlight Toolkit and not of the native runtime.<\/i> \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 27px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">xmlns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\/sdk&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Add data to the DataGrid control. To populate the DataGrid control with the Sample Data Collection generated from the Expression Blend, add the following XAML code. By setting the Height and the Width to &ldquo;Auto&rdquo;, the grid dynamically resizes itself based on the size of the content:\n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">UserControl.Resources<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Key<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;ImageTemplate&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Image<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Source<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Image<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;64&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;64&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">UserControl.Resources<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;LayoutRoot&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Background<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;White&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> DataContext<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Source<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">={<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Contacts<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}}&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">RowDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.RowDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Row<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> FontSize<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;24&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;8,8,0,0&#8243;&gt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Contact Details<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGrid<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> AutoGenerateColumns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;False&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Row<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Auto&#8221;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: red\"><span>&nbsp;<\/span>Width<\/span><span style=\"color: blue\">=&#8221;Auto&#8221;<\/span><span style=\"color: red\"> HorizontalAlignment<\/span><span style=\"color: blue\">=&#8221;Left&#8221;<\/span><span style=\"color: red\"> Margin<\/span><span style=\"color: blue\">=&#8221;0,16,0,0&#8243;<\/span> <\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: red\"><span>&nbsp;<\/span>x<\/span><span style=\"color: blue\">:<\/span><span style=\"color: red\">Name<\/span><span style=\"color: blue\">=&#8221;ContactsDataGrid&#8221;<\/span><span style=\"color: red\"> VerticalAlignment<\/span><span style=\"color: blue\">=&#8221;Top&#8221;<\/span><span style=\"color: red\"> ItemsSource<\/span><span style=\"color: blue\">=&#8221;{<\/span><span style=\"color: #a31515\">Binding<\/span><span style=\"color: red\"> Collection<\/span><span style=\"color: blue\">}&#8221;&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGrid.Columns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTextColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Name&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTemplateColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> CellTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> ImageTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Image&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTextColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Address<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Address&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTextColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Email<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Email&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTextColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> PhoneNumber<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;PhoneNumber&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGridTextColumn<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> WebSite<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Header<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;WebSite&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGrid.Columns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">sdk<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataGrid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">The user interface should look like the following: <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/6761.UI1_.gif\" border=\"0\" \/><\/span><\/li>\n<\/ol>\n<h3><b>Step 2: Create a Form Entry to Edit the Interface Details<\/b><\/h3>\n<p><span style=\"font-size: small\">Now let&rsquo;s create a form entry to edit the interface details. In this step, we will see how to create a new UserControl and create a data entry form. To create a new UserControl, follow these steps: <\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">To add a new UserControl, right-click the PanelsControlsLab project, select add, and then select New Item. The Add New Item dialog box opens. <\/span><\/li>\n<li><span style=\"font-size: small\">Browse to the &ldquo;Silverlight&rdquo; node, and select the &ldquo;Silverlight User Control&rdquo; template. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/1680.AddUserControl.gif\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name of the UserControl as &ldquo;EditContacts.xaml&rdquo;, and click &ldquo;Add&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Create the form entries for each field in the DataGrid (Name, Image, Address, Email, Phone number, and Website). To create all the fields and edit the Text property of each field, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;12,16,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;348&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Name&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;12,46,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox2&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;348&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Image Location&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;12,74,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox3&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;348&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Address&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;12,104,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox4&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;348&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Email&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;10,134,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox5&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;350&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Phone Number&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;23&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;10,164,0,0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;textBox6&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;350&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Website&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<\/div>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/4722.UserControl.gif\" border=\"0\" \/><br \/><\/span><\/li>\n<li><span style=\"font-size: small\">Build the project, so that the UserControl can appear in the Toolbox. <\/span><\/li>\n<li><span style=\"font-size: small\">Open the MainPage.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">Open the Toolbox. You will be able to see EditContacts (PanelControlsLab) as a new control in the Toolbox. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/3733.Toolbox.gif\" border=\"0\" \/><br \/><i>Note: The EditContacts (PanelControlsLab) control will not appear in the Toolbox list, if you are currently working on the EditContacts.xaml page.<\/i> <\/span><\/li>\n<li><span style=\"font-size: small\">Drag and drop the EditContacts (PanelControlsLab) control onto the design view. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/4454.AddtoUI.gif\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">A new xmlns (XML Namespace) declaration is automatically added in the XAML code. This represents the current project, and lets the runtime know where to find the control. \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 27px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">xmlns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">my<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;clr-namespace:PanelsControlsLab&#8221;<\/span><\/p>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">At the top of the page, add a button to enable the user to open the Add Contact interface. To add the button, drag and drop the ToggleButton control onto the design view. <br \/><i>Note: If you cannot see the ToggleButton control in the Toolbox, add it by clicking the Toolbox and clicking Choose Items from the popup menu. The Choose Items dialog box will be displayed. Select the ToogleButton checkbox and click OK. The ToogleButton control will get added to the Toolbox.<\/i> <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/5826.ToggleButton.gif\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">Change the Content property of the ToggleButton control to &ldquo;Add new contact&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Change the Visibility property of the EditContacts (PanelControlsLab) control to &ldquo;Collapsed&rdquo;. The property is set to Collapsed so that the EditContacts UserControl is visible only when the ToggleButton is checked and doesn&rsquo;t open by default. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/6180.VisibilityProperty.gif\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">Add the event handlers for the Checked and UnChecked events of the ToggleButton to hide and show the EditContacts (PanelControlsLab) control, respectively. To add the event handlers, open the Main.Page.vb page and add the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Namespace<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> PanelsControlsLab<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Partial<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">MainPage<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Inherits<\/span> UserControl<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> <span style=\"color: blue\">New<\/span>()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>InitializeComponent()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> <span style=\"color: blue\">Sub<\/span> AddContactButton_Checked(<span style=\"color: blue\">ByVal<\/span> sender <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> System.Windows.RoutedEventArgs)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Me<\/span>.AddContactPanel.Visibility = System.Windows.Visibility.Visible<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> <span style=\"color: blue\">Sub<\/span> AddContactButton_Unchecked(<span style=\"color: blue\">ByVal<\/span> sender <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> RoutedEventArgs)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Me<\/span>.AddContactPanel.Visibility = System.Windows.Visibility.Collapsed<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Class<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Namespace<\/span><\/span><\/p>\n<\/div>\n<p><i>Note: There&rsquo;s a shortcut to add an Event Handler. Select Checked in the Events property of the CheckBox control. Double-click the event to automatically generate the event handler (AddContactButton_Checked) for the CheckBox. Repeat this step for the UnChecked event and the AddContactButton_UnChecked event handler will be generated. In the AddContactButton_Checked handler, set the visibility of the EditContacts (PanelControlsLab) control to System.Windows.Visibility.Visible and in the AddContactButton_UnChecked handler, set it to System.Windows.Visibility.Collapsed.<\/i> <\/span><\/li>\n<li><span style=\"font-size: small\">Open the EditContacts.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">Drag and drop a Button control from the Toolbox onto the design view. <\/span><\/li>\n<li><span style=\"font-size: small\">Change the Text property of the Button control to &ldquo;Add Contact&rdquo;. This button will add the data entered in these fields into the DataGrid. <\/span><\/li>\n<li><span style=\"font-size: small\">To add the border to the Edit Contacts window, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Border<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> BorderThickness<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;227&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;border1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Top&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;372&#8243;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;<\/span><span>&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Border.BorderBrush<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">LinearGradientBrush<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> EndPoint<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1,0.5&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> StartPoint<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0,0.5&#8243;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">GradientStop<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Color<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Black&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Offset<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0&#8243; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">GradientStop<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Color<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;#FF443B3B&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Offset<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1&#8243; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">LinearGradientBrush<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Border.BorderBrush<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Border<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/6136.UserControl1.gif\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">The user interface will look like the following: <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/2620.UI2_.gif\" border=\"0\" \/><\/span><\/li>\n<\/ol>\n<h3><b>Step 3: Add a Menu using the StackPanel<\/b><\/h3>\n<p><span style=\"font-size: small\">Now let&rsquo;s add a menu using the StackPanel. In the StackPanel, the contained elements can be organized either vertically or horizontally by changing the Orientation property appropriately. In this case, we are going to add two more menu items (edit contacts and help) along with the Add new contact button and align the StackPanel horizontally. To add the menu items, follow these steps:<\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">Add a ToggleButton control for editing the contacts and a Button control for opening the help page. Place the items next to the Add new contact button. Set the margins and HorizontalAlignment of each button. <\/span><\/li>\n<li><span style=\"font-size: small\">Create a StackPanel and move the three controls inside the panel. To create a StackPanel, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 94.8%;font-family: 'Courier New',courier,monospace;direction: ltr;height: 94px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Right&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0,8,8,11&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Orientation<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Horizontal&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span><\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ToggleButton<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;AddContactButton&#8221;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: red\">Content<\/span><span style=\"color: blue\">=&#8221;Add new contact&#8221;<\/span> <span style=\"color: red\">Checked<\/span><span style=\"color: blue\">=&#8221;AddContactButton_Checked&#8221;<\/span> <span style=\"color: red\">Unchecked<\/span><span style=\"color: blue\">=&#8221;AddContactButton_Unchecked&#8221; <\/span><span style=\"color: red\">Height<\/span><span style=\"color: blue\">=&#8221;24&#8243;<\/span> <span style=\"color: red\">Margin<\/span><span style=\"color: blue\">=&#8221;0,0,5,0&#8243; \/&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span><\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ToggleButton<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;EditContactButton&#8221;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: red\">Content<\/span><span style=\"color: blue\">=&#8221;Edit contact&#8221;<\/span> <span style=\"color: red\">Checked<\/span><span style=\"color: blue\">=&#8221;AddContactButton_Checked&#8221;<\/span> <span style=\"color: red\">Unchecked<\/span><span style=\"color: blue\">=&#8221;AddContactButton_Unchecked&#8221;<\/span> <span style=\"color: red\">Height<\/span><span style=\"color: blue\">=&#8221;24&#8243;<\/span> <span style=\"color: red\">Margin<\/span><span style=\"color: blue\">=&#8221;0,0,5,0&#8243; \/&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Button<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;HelpButton&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Content<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Help&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">The menu will look like the following: <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/04\/7167.UI3_.gif\" border=\"0\" \/><\/span><\/li>\n<\/ol>\n<h3><b>Summary<\/b><\/h3>\n<p><span style=\"font-size: small\">In this walkthrough, you have learned how to create a Data-Driven Silverlight Interface using Panels, XAML, and Controls . You have now successfully added a data entry form to the existing project and created a menu using the StackPanel. <\/span><\/p>\n<p><span style=\"font-size: small\">You can find the full source code for the application <\/span><a href=\"http:\/\/www.silverlight.net\/learn\/tutorials\/silverlight-4\/working-with-panels-xaml-and-controls\/\"><span style=\"font-size: small\">here<\/span><\/a><span style=\"font-size: small\">. <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am back with details on how to work with Panels, XAML, and Controls in Silverlight. In this walkthrough, we will see how to work with Panels, XAML, and Controls to create a Data-Driven Silverlight Interface. During this walkthrough we will cover the following topics: How to use the Visual Studio 2010 Silverlight Designer, Cider [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[195],"tags":[137,138,167,177],"class_list":["post-573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-basic","tag-silverlight","tag-silverlight-4-firestarter","tag-vb2010","tag-wcf"],"acf":[],"blog_post_summary":"<p>I am back with details on how to work with Panels, XAML, and Controls in Silverlight. In this walkthrough, we will see how to work with Panels, XAML, and Controls to create a Data-Driven Silverlight Interface. During this walkthrough we will cover the following topics: How to use the Visual Studio 2010 Silverlight Designer, Cider [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=573"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/573\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}