WPF C# Tutorial

    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">
    
  
    Grid Column and Row Collections
        
          
            
          

          
          
            
          

        
        
            Remove One Row
            
  
    

//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 removeRow(object sender, RoutedEventArgs e)
        {
            if (grid1.RowDefinitions.Count <= 0)
            {
                Console.WriteLine("No More Rows to Remove!");
            }
            else
            {
                grid1.RowDefinitions.RemoveAt(0);
            }
        }
    }
}