Remove 5 Row with RowDefinitions.RemoveRange

image_pdfimage_print




Grid Column and Row Collections















//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 rem5Row(object sender, RoutedEventArgs e)
{
if (grid1.RowDefinitions.Count < 5) { Console.WriteLine("less than 5!"); } else { grid1.RowDefinitions.RemoveRange(0, 5); } } } } [/csharp]