diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md index 6e1039d55c..56473879e6 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md @@ -1,6 +1,7 @@ --- title: Create a Multipane User Interface -ms.date: "03/30/2017" +description: Describes how to layout Windows Forms controls to mimic a Microsoft Outlook email application. +ms.date: 01/21/2022 dev_langs: - "csharp" - "vb" @@ -14,162 +15,53 @@ helpviewer_keywords: ms.assetid: e79f6bcc-3740-4d1e-b46a-c5594d9b7327 --- # How to: Create a Multipane User Interface with Windows Forms -In the following procedure, you will create a multipane user interface that is similar to the one used in Microsoft Outlook, with a **Folder** list, a **Messages** pane, and a **Preview** pane. This arrangement is achieved chiefly through docking controls with the form. - - When you dock a control, you determine which edge of the parent container a control is fastened to. Thus, if you set the property to , the right edge of the control will be docked to the right edge of its parent control. Additionally, the docked edge of the control is resized to match that of its container control. For more information about how the property works, see [How to: Dock Controls on Windows Forms](how-to-dock-controls-on-windows-forms.md). - - This procedure focuses on arranging the and the other controls on the form, not on adding functionality to make the application mimic Microsoft Outlook. - - To create this user interface, you place all the controls within a control, which contains a control in the left-hand panel. The right-hand panel of the control contains a second control with a control above a control. These controls enable independent resizing of the other controls on the form. You can adapt the techniques in this procedure to craft custom user interfaces of your own. - -### To create an Outlook-style user interface programmatically - -1. Within a form, declare each control that comprises your user interface. For this example, use the , , , and controls to mimic the Microsoft Outlook user interface. - - ```vb - Private WithEvents treeView1 As System.Windows.Forms.TreeView - Private WithEvents listView1 As System.Windows.Forms.ListView - Private WithEvents richTextBox1 As System.Windows.Forms.RichTextBox - Private WithEvents splitContainer1 As _ - System.Windows.Forms.SplitContainer - Private WithEvents splitContainer2 As _ - System.Windows.Forms.SplitContainer - ``` - - ```csharp - private System.Windows.Forms.TreeView treeView1; - private System.Windows.Forms.ListView listView1; - private System.Windows.Forms.RichTextBox richTextBox1; - private System.Windows.Forms. SplitContainer splitContainer2; - private System.Windows.Forms. SplitContainer splitContainer1; - ``` - -2. Create a procedure that defines your user interface. The following code sets the properties so that the form will resemble the user interface in Microsoft Outlook. However, by using other controls or docking them differently, it is just as easy to create other user interfaces that are equally flexible. - - ```vb - Public Sub CreateOutlookUI() - ' Create an instance of each control being used. - Me.components = New System.ComponentModel.Container() - Me.treeView1 = New System.Windows.Forms.TreeView() - Me.listView1 = New System.Windows.Forms.ListView() - Me.richTextBox1 = New System.Windows.Forms.RichTextBox() - Me.splitContainer1 = New System.Windows.Forms.SplitContainer() - Me.splitContainer2= New System.Windows.Forms. SplitContainer() - - ' Should you develop this into a working application, - ' use the AddHandler method to hook up event procedures here. - - ' Set properties of TreeView control. - ' Use the With statement to avoid repetitive code. - With Me.treeView1 - .Dock = System.Windows.Forms.DockStyle.Fill - .TabIndex = 0 - .Nodes.Add("treeView") - End With - - ' Set properties of ListView control. - With Me.listView1 - .Dock = System.Windows.Forms.DockStyle.Top - .TabIndex = 2 - .Items.Add("listView") - End With - - ' Set properties of RichTextBox control. - With Me.richTextBox1 - .Dock = System.Windows.Forms.DockStyle.Fill - .TabIndex = 3 - .Text = "richTextBox1" - End With - - ' Set properties of the first SplitContainer control. - With Me.splitContainer1 - .Dock = System.Windows.Forms.DockStyle.Fill - .TabIndex = 1 - .SplitterWidth = 4 - .SplitterDistance = 150 - .Orientation = Orientation.Horizontal - .Panel1.Controls.Add(Me.listView1) - .Panel2.Controls.Add(Me.richTextBox1) - End With - - ' Set properties of the second SplitContainer control. - With Me.splitContainer2 - .Dock = System.Windows.Forms.DockStyle.Fill - .TabIndex = 4 - .SplitterWidth = 4 - .SplitterDistance = 100 - .Panel1.Controls.Add(Me.treeView1) - .Panel2.Controls.Add(Me.SplitContainer1) - End With - - ' Add the main SplitContainer control to the form. - Me.Controls.Add(Me.splitContainer2) - Me.Text = "Intricate UI Example" - End Sub - ``` - - ```csharp - public void createOutlookUI() - { - // Create an instance of each control being used. - treeView1 = new System.Windows.Forms.TreeView(); - listView1 = new System.Windows.Forms.ListView(); - richTextBox1 = new System.Windows.Forms.RichTextBox(); - splitContainer2 = new System.Windows.Forms.SplitContainer(); - splitContainer1 = new System.Windows.Forms.SplitContainer(); - - // Insert code here to hook up event methods. - - // Set properties of TreeView control. - treeView1.Dock = System.Windows.Forms.DockStyle.Fill; - treeView1.TabIndex = 0; - treeView1.Nodes.Add("treeView"); - - // Set properties of ListView control. - listView1.Dock = System.Windows.Forms.DockStyle.Top; - listView1.TabIndex = 2; - listView1.Items.Add("listView"); - - // Set properties of RichTextBox control. - richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - richTextBox1.TabIndex = 3; - richTextBox1.Text = "richTextBox1"; - - // Set properties of first SplitContainer control. - splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - splitContainer2.TabIndex = 1; - splitContainer2.SplitterWidth = 4; - splitContainer2.SplitterDistance = 150; - splitContainer2.Orientation = Orientation.Horizontal; - splitContainer2.Panel1.Controls.Add(this.listView1); - splitContainer2.Panel1.Controls.Add(this.richTextBox1); - - // Set properties of second SplitContainer control. - splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - splitContainer2.TabIndex = 4; - splitContainer2.SplitterWidth = 4; - splitContainer2.SplitterDistance = 100; - splitContainer2.Panel1.Controls.Add(this.treeView1); - splitContainer2.Panel1.Controls.Add(this.splitContainer1); - - // Add the main SplitContainer control to the form. - this.Controls.Add(this.splitContainer2); - this.Text = "Intricate UI Example"; - } - ``` - -3. In Visual Basic, add a call to the procedure you just created in the `New()` procedure. In Visual C#, add this line of code to the constructor for the form class. - - ```vb - ' Add this to the New procedure. - CreateOutlookUI() - ``` - - ```csharp - // Add this to the form class's constructor. - createOutlookUI(); - ``` - + +By arranging controls on a form, you can create a multi-pane user interface that's similar to the one used in Microsoft Outlook, with a **Folder** list, a **Messages** pane, and a **Preview** pane. This arrangement is achieved chiefly through docking controls with the form. + +When you dock a control, you determine which edge of the parent container a control is fastened to. If you set the property to , the right edge of the control will be docked to the right edge of its parent control. Additionally, the docked edge of the control is resized to match that of its container control. For more information about how the property works, see [How to: Dock Controls on Windows Forms](how-to-dock-controls-on-windows-forms.md). + +This procedure focuses on arranging the and the other controls on the form, not on adding functionality to make the application mimic Microsoft Outlook. + +:::image type="content" source="media/how-to-create-a-multipane-user-interface-with-windows-forms/form.png" alt-text="A form that's designed to look like an Outlook mail window."::: + +To create this user interface, you place all the controls within a control. The `SplitContainer` contains a control in the left-hand panel and another `SplitContainer` on the right-hand panel. The second `SplitContainer` contains a control on top and a control on the bottom. + +These controls enable independent resizing of the other controls on the form. You can adapt the techniques in this procedure to craft custom user interfaces of your own. + +## Control layout + +The following table describes how the controls are configured to mimic Microsoft Outlook: + +| Control | Property | Value | +|----------------|------------------|--------------------------------------------------| +| SplitContainer | Name | `splitContainer1` | +| | Dock | `Fill` | +| | TabIndex | `4` | +| | SplitterWidth | `4` | +| | SplitterDistance | `100` | +| | Panel1.Controls | Add the `treeView1` control to this panel. | +| | Panel2.Controls | Add the `splitContainer2` control to this panel. | +| TreeView | Name | `treeView1` | +| | Dock | `Fill` | +| | TabIndex | `0` | +| | Nodes | Add a new node named `Node0` | +| SplitContainer | Name | `splitContainer2` | +| | Dock | `Fill` | +| | TabIndex | `1` | +| | SplitterWidth | `4` | +| | SplitterDistance | `150` | +| | Orientation | `Horizontal` | +| | Panel1.Controls | Add the `listView1` control to this panel. | +| | Panel2.Controls | Add the `richTextBox1` control to this panel. | +| ListView | Name | `listView1` | +| | Dock | `Fill` | +| | TabIndex | `2` | +| | Items | Add a new item and set the text to `item1`. | +| RichTextBox | Name | `richTextBox1` | +| | Dock | `Fill` | +| | TabIndex | `3` | +| | Text | `richTextBox1` | + ## See also - diff --git a/dotnet-desktop-guide/framework/winforms/controls/media/how-to-create-a-multipane-user-interface-with-windows-forms/form.png b/dotnet-desktop-guide/framework/winforms/controls/media/how-to-create-a-multipane-user-interface-with-windows-forms/form.png new file mode 100644 index 0000000000..c916fe2fac Binary files /dev/null and b/dotnet-desktop-guide/framework/winforms/controls/media/how-to-create-a-multipane-user-interface-with-windows-forms/form.png differ diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.Designer.cs b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.Designer.cs new file mode 100644 index 0000000000..a3d83e84ef --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.Designer.cs @@ -0,0 +1,147 @@ + +namespace project +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Node0"); + System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("item1"); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.listView1 = new System.Windows.Forms.ListView(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.treeView1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(448, 366); + this.splitContainer1.SplitterDistance = 100; + this.splitContainer1.TabIndex = 1; + // + // treeView1 + // + this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeView1.Location = new System.Drawing.Point(0, 0); + this.treeView1.Name = "treeView1"; + treeNode1.Name = "Node0"; + treeNode1.Text = "Node0"; + this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + treeNode1}); + this.treeView1.Size = new System.Drawing.Size(100, 366); + this.treeView1.TabIndex = 0; + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.listView1); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.richTextBox1); + this.splitContainer2.Size = new System.Drawing.Size(344, 366); + this.splitContainer2.SplitterDistance = 156; + this.splitContainer2.TabIndex = 1; + // + // listView1 + // + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.HideSelection = false; + this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] { + listViewItem1}); + this.listView1.Location = new System.Drawing.Point(0, 0); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(344, 156); + this.listView1.TabIndex = 2; + this.listView1.UseCompatibleStateImageBehavior = false; + // + // richTextBox1 + // + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Location = new System.Drawing.Point(0, 0); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(344, 206); + this.richTextBox1.TabIndex = 3; + this.richTextBox1.Text = "richTextBox1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(448, 366); + this.Controls.Add(this.splitContainer1); + this.Margin = new System.Windows.Forms.Padding(2); + this.Name = "Form1"; + this.Text = "Form1"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.TreeView treeView1; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.RichTextBox richTextBox1; + } +} + diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.cs b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.cs new file mode 100644 index 0000000000..a7cac9af99 --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace project +{ + public partial class Form1 : Form + { + //Windows Form application + public Form1() + { + InitializeComponent(); + } + } +} diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.resx b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Program.cs b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Program.cs new file mode 100644 index 0000000000..b7580e129c --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace project +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/project.csproj b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/project.csproj new file mode 100644 index 0000000000..1c2538b11f --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/project.csproj @@ -0,0 +1,65 @@ + + + + + Debug + AnyCPU + {50B5AD53-1181-46C6-91EE-0E65BADF34E1} + WinExe + project + project + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + CurrentArchitecture + CurrentRuntime + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + Form1.cs + + + + \ No newline at end of file diff --git a/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/readme.txt b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/readme.txt new file mode 100644 index 0000000000..47cb859fbb --- /dev/null +++ b/dotnet-desktop-guide/framework/winforms/controls/snippets/how-to-create-a-multipane-user-interface-with-windows-forms/readme.txt @@ -0,0 +1 @@ +This code is used to generate the screenshot referenced in the parent article. diff --git a/dotnet-desktop-guide/framework/wpf/advanced/xaml-syntax-in-detail.md b/dotnet-desktop-guide/framework/wpf/advanced/xaml-syntax-in-detail.md index 261e872505..7bc0475392 100644 --- a/dotnet-desktop-guide/framework/wpf/advanced/xaml-syntax-in-detail.md +++ b/dotnet-desktop-guide/framework/wpf/advanced/xaml-syntax-in-detail.md @@ -33,6 +33,7 @@ helpviewer_keywords: ms.assetid: 67cce290-ca26-4c41-a797-b68aabc45479 --- # XAML Syntax In Detail + This topic defines the terms that are used to describe the elements of XAML syntax. These terms are used frequently throughout the remainder of this documentation, both for WPF documentation specifically and for the other frameworks that use XAML or the basic XAML concepts enabled by the XAML language support at the System.Xaml level. This topic expands on the basic terminology introduced in the topic [XAML in WPF](xaml-in-wpf.md). This topic defines the terms that are used to describe the elements of XAML syntax. These terms are used frequently throughout the remainder of this documentation, both for WPF documentation specifically and for the other frameworks that use XAML or the basic XAML concepts enabled by the XAML language support at the System.Xaml level. This topic expands on the basic terminology introduced in the topic [XAML Overview (WPF)](/dotnet/desktop-wpf/fundamentals/xaml). @@ -69,7 +70,47 @@ For example, the following example is object element syntax that instantiates a The following example is object element syntax that also includes XAML content property syntax. The inner text contained within will be used to set the XAML content property, . -[!code-xaml[XAMLOvwSupport#ThisIsATextBox](~/samples/snippets/csharp/VS_Snippets_Wpf/XAMLOvwSupport/CSharp/Page1.xaml#thisisatextbox)] + For more information about the XAML language specification, download [\[MS-XAML\]](https://download.microsoft.com/download/0/A/6/0A6F7755-9AF5-448B-907D-13985ACCF53E/[MS-XAML].pdf) from the Microsoft Download Center. + + +## XAML and CLR + XAML is a markup language. The common language runtime (CLR), as implied by its name, enables runtime execution. XAML is not by itself one of the common languages that is directly consumed by the CLR runtime. Instead, you can think of XAML as supporting its own type system. The particular XAML parsing system that is used by WPF is built on the CLR and the CLR type system. XAML types are mapped to CLR types to instantiate a run time representation when the XAML for WPF is parsed. For this reason, the remainder of discussion of syntax in this document will include references to the CLR type system, even though the equivalent syntax discussions in the XAML language specification do not. (Per the XAML language specification level, XAML types could be mapped to any other type system, which does not have to be the CLR, but that would require the creation and use of a different XAML parser.) + +#### Members of Types and Class Inheritance + Properties and events as they appear as XAML members of a WPF type are often inherited from base types. For example, consider this example: `` @@ -280,7 +321,7 @@ The value of a XAML content property must be given either entirely before or ent ||| |-|-| |``|End of object element for the root. Object is not closed yet because the element contains child elements| diff --git a/dotnet-desktop-guide/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md b/dotnet-desktop-guide/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md index 16d6f1877d..3f0b2ac5ed 100644 --- a/dotnet-desktop-guide/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md +++ b/dotnet-desktop-guide/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md @@ -16,12 +16,12 @@ This example shows how to use the methods in the element with a of `grid1`. The contains a that holds elements, each controlled by a different collection method. When you click a , it activates a method call in the code-behind file. - [!code-xaml[ColumnDefinitionsGrid#1](~/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml#1)] +:::code language="xaml" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml" id="Snippet1"::: This example defines a series of custom methods, each corresponding to a event in the [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] file. You can change the number of columns and rows in the in several ways, which includes adding or removing rows and columns; and counting the total number of rows and columns. To prevent and exceptions, you can use the error-checking functionality that the method provides. - [!code-csharp[ColumnDefinitionsGrid#2](~/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml.cs#2)] - [!code-vb[ColumnDefinitionsGrid#2](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml.vb#2)] +:::code language="csharp" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml.cs" id="Snippet2"::: +:::code language="vb" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml.vb" id="Snippet2"::: ## See also diff --git a/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml new file mode 100644 index 0000000000..1c7b6bfac2 --- /dev/null +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml @@ -0,0 +1,54 @@ + + + + + + Grid Column and Row Collections + Click any of the buttons below to invoke the associated methods and properties of ColumnDefinition and RowDefinition Collections. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml.cs b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml.cs similarity index 100% rename from dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml.cs rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml.cs diff --git a/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.config b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.config new file mode 100644 index 0000000000..3e0e37cfc8 --- /dev/null +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.config @@ -0,0 +1,3 @@ + + + diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/app.xaml b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.xaml similarity index 100% rename from dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/app.xaml rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.xaml diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/app.xaml.cs b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.xaml.cs similarity index 100% rename from dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/app.xaml.cs rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/app.xaml.cs diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/columndefinitions_grid.csproj b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/columndefinitions_grid.csproj similarity index 76% rename from dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/columndefinitions_grid.csproj rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/columndefinitions_grid.csproj index 925a490e5f..5ad2143bbe 100644 --- a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/columndefinitions_grid.csproj +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/columndefinitions_grid.csproj @@ -1,14 +1,19 @@ - + SDKSample winexe Debug 2.0 bin\$(Configuration)\ - v4.0 + v4.8 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Client + + 10.0.20821 + {4BDD3A99-C878-405A-9108-7C948EA50659} + + + false @@ -44,4 +49,7 @@ Code + + + \ No newline at end of file diff --git a/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/snippets.5000.json b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/snippets.5000.json new file mode 100644 index 0000000000..9493e73361 --- /dev/null +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/snippets.5000.json @@ -0,0 +1,3 @@ +{ + "host": "visualstudio" +} \ No newline at end of file diff --git a/dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/ColumnDefinitionsGrid.vbproj b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/ColumnDefinitionsGrid.vbproj similarity index 74% rename from dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/ColumnDefinitionsGrid.vbproj rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/ColumnDefinitionsGrid.vbproj index 6aa710cbc9..c6947d7ad4 100644 --- a/dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/ColumnDefinitionsGrid.vbproj +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/ColumnDefinitionsGrid.vbproj @@ -1,14 +1,19 @@ - + SDKSample winexe Debug 2.0 bin\$(Configuration)\ - v4.0 + v4.8 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} - Client + + 10.0.20821 + {9CD74B47-FC44-43A0-B18E-FFF7B4EA3EF8} + + + false @@ -39,4 +44,7 @@ Code + + + \ No newline at end of file diff --git a/dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml similarity index 100% rename from dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml diff --git a/dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml.vb b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml.vb similarity index 100% rename from dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml.vb rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml.vb diff --git a/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/app.config b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/app.config new file mode 100644 index 0000000000..b5cb6d50fc --- /dev/null +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/app.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/app.xaml b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/app.xaml similarity index 100% rename from dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/app.xaml rename to dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/app.xaml diff --git a/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/snippets.5000.json b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/snippets.5000.json new file mode 100644 index 0000000000..9493e73361 --- /dev/null +++ b/dotnet-desktop-guide/framework/wpf/controls/snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/snippets.5000.json @@ -0,0 +1,3 @@ +{ + "host": "visualstudio" +} \ No newline at end of file diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml deleted file mode 100644 index 2a15d60cfb..0000000000 --- a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Grid Column and Row Collections - Click any of the buttons below to invoke the associated methods and properties of ColumnDefinition and RowDefinition Collections. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -