Add a RowDefinition to Grid : Grid Operations « Windows Presentation Foundation « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Windows Presentation Foundation » Grid Operations 
24.45.17.Add a RowDefinition to Grid
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="WpfApplication1.Window1"
    Title="ColumnDefinitions Sample">
    <Border BorderBrush="Black" Background="White" BorderThickness="2">
  <DockPanel Margin="10,0,0,0">
    <TextBlock FontSize="20" FontWeight="Bold" DockPanel.Dock="Top">Grid Column and Row Collections</TextBlock>
        <Grid DockPanel.Dock="Top" HorizontalAlignment="Left" Name="grid1" ShowGridLines="true" Width="625" Height="400">
          <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
          <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
          </Grid.RowDefinitions>
        </Grid>

        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
            <Button Width="125" Click="addRow">Add Row</Button>
        </StackPanel>    

  </DockPanel>
  </Border>  
</Window>
//File:Window.xaml.cs


using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;

namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        RowDefinition rowDef1;
        ColumnDefinition colDef1;

        private void addRow(object sender, RoutedEventArgs e)
        {
            rowDef1 = new RowDefinition();
            grid1.RowDefinitions.Add(rowDef1);
        }

    }
}
WPF Add A Row Definition To Grid
24.45.Grid Operations
24.45.1.Set Row Height and column Width for GridSet Row Height and column Width for Grid
24.45.2.Set Row and Column Index when Adding Buttons to GridSet Row and Column Index when Adding Buttons to Grid
24.45.3.Clear All ColumnsClear All Columns
24.45.4.Clear All RowsClear All Rows
24.45.5.Remove One ColumnRemove One Column
24.45.6.Remove One RowRemove One Row
24.45.7.The current number of ColumnsThe current number of Columns
24.45.8.The current number of RowsThe current number of Rows
24.45.9.Remove 5 Columns with ColumnDefinitions.RemoveRangeRemove 5 Columns with ColumnDefinitions.RemoveRange
24.45.10.Remove 5 Row with RowDefinitions.RemoveRangeRemove 5 Row with RowDefinitions.RemoveRange
24.45.11.Contains RowContains Row
24.45.12.Contains Column?Contains Column?
24.45.13.Insert RowInsert Row
24.45.14.Insert ColumnInsert Column
24.45.15.Is Grid ReadOnlyIs Grid ReadOnly
24.45.16.Add a ColumnDefinition to GridAdd a ColumnDefinition to Grid
24.45.17.Add a RowDefinition to GridAdd a RowDefinition to Grid
24.45.18.Setting Grid row heights in codeSetting Grid row heights in code
24.45.19.Set control to specific row and column in codeSet control to specific row and column in code
24.45.20.Show Grid lines in codeShow Grid lines in code
24.45.21.Programmatically use the positioning methods of GridProgrammatically use the positioning methods of Grid
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.