Export (0) Print
Expand All

ColumnDefinitionCollection Class

Provides access to an ordered, strongly typed collection of ColumnDefinition objects.

System.Object
  System.Windows.Controls.ColumnDefinitionCollection

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public sealed class ColumnDefinitionCollection : IList<ColumnDefinition>, 
	ICollection<ColumnDefinition>, IEnumerable<ColumnDefinition>, IList, 
	ICollection, IEnumerable

The ColumnDefinitionCollection type exposes the following members.

  NameDescription
Public propertyCountGets the total number of items within this instance of ColumnDefinitionCollection.
Public propertyIsReadOnlyGets a value that indicates whether a ColumnDefinitionCollection is read-only.
Public propertyIsSynchronizedGets a value that indicates whether access to this ColumnDefinitionCollection is synchronized (thread safe).
Public propertyItemGets a value that indicates the current item within a ColumnDefinitionCollection.
Public propertySyncRootGets an object that can be used to synchronize access to the ColumnDefinitionCollection.
Top

  NameDescription
Public methodAddAdds a ColumnDefinition element to a ColumnDefinitionCollection.
Public methodClearClears the content of the ColumnDefinitionCollection.
Public methodContainsDetermines whether a given ColumnDefinition exists within a ColumnDefinitionCollection.
Public methodCopyToCopies an array of ColumnDefinition objects to a given index position within a ColumnDefinitionCollection.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOfReturns the index position of a given ColumnDefinition within a ColumnDefinitionCollection.
Public methodInsertInserts a ColumnDefinition at the specified index position within a ColumnDefinitionCollection.
Public methodRemoveRemoves a ColumnDefinition from a ColumnDefinitionCollection.
Public methodRemoveAtRemoves a ColumnDefinition from a ColumnDefinitionCollection at the specified index position.
Public methodRemoveRangeRemoves a range of ColumnDefinition objects from a ColumnDefinitionCollection.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAggregate<ColumnDefinition>(Func<ColumnDefinition, ColumnDefinition, ColumnDefinition>)Overloaded. Applies an accumulator function over a sequence. (Defined by Enumerable.)
Public Extension MethodAggregate<ColumnDefinition, TAccumulate>(TAccumulate, Func<TAccumulate, ColumnDefinition, TAccumulate>)Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. (Defined by Enumerable.)
Public Extension MethodAggregate<ColumnDefinition, TAccumulate, TResult>(TAccumulate, Func<TAccumulate, ColumnDefinition, TAccumulate>, Func<TAccumulate, TResult>)Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. (Defined by Enumerable.)
Public Extension MethodAll<ColumnDefinition>Determines whether all elements of a sequence satisfy a condition. (Defined by Enumerable.)
Public Extension MethodAny<ColumnDefinition>()Overloaded. Determines whether a sequence contains any elements. (Defined by Enumerable.)
Public Extension MethodAny<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Determines whether any element of a sequence satisfies a condition. (Defined by Enumerable.)
Public Extension MethodAsEnumerable<ColumnDefinition>Returns the input typed as IEnumerable<T>. (Defined by Enumerable.)
Public Extension MethodAsParallel()Overloaded. Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsParallel<ColumnDefinition>()Overloaded. Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryable()Overloaded. Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodAsQueryable<ColumnDefinition>()Overloaded. Converts a generic IEnumerable<T> to a generic IQueryable<T>. (Defined by Queryable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Nullable<Decimal>>)Overloaded. Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Nullable<Double>>)Overloaded. Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Int32>)Overloaded. Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int32>>)Overloaded. Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Int64>)Overloaded. Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int64>>)Overloaded. Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Single>)Overloaded. Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Nullable<Single>>)Overloaded. Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Double>)Overloaded. Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodAverage<ColumnDefinition>(Func<ColumnDefinition, Decimal>)Overloaded. Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodConcat<ColumnDefinition>Concatenates two sequences. (Defined by Enumerable.)
Public Extension MethodContains<ColumnDefinition>(ColumnDefinition)Overloaded. Determines whether a sequence contains a specified element by using the default equality comparer. (Defined by Enumerable.)
Public Extension MethodContains<ColumnDefinition>(ColumnDefinition, IEqualityComparer<ColumnDefinition>)Overloaded. Determines whether a sequence contains a specified element by using a specified IEqualityComparer<T>. (Defined by Enumerable.)
Public Extension MethodCount<ColumnDefinition>()Overloaded. Returns the number of elements in a sequence. (Defined by Enumerable.)
Public Extension MethodCount<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns a number that represents how many elements in the specified sequence satisfy a condition. (Defined by Enumerable.)
Public Extension MethodDefaultIfEmpty<ColumnDefinition>()Overloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
Public Extension MethodDefaultIfEmpty<ColumnDefinition>(ColumnDefinition)Overloaded. Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
Public Extension MethodDistinct<ColumnDefinition>()Overloaded. Returns distinct elements from a sequence by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension MethodDistinct<ColumnDefinition>(IEqualityComparer<ColumnDefinition>)Overloaded. Returns distinct elements from a sequence by using a specified IEqualityComparer<T> to compare values. (Defined by Enumerable.)
Public Extension MethodElementAt<ColumnDefinition>Returns the element at a specified index in a sequence. (Defined by Enumerable.)
Public Extension MethodElementAtOrDefault<ColumnDefinition>Returns the element at a specified index in a sequence or a default value if the index is out of range. (Defined by Enumerable.)
Public Extension MethodExcept<ColumnDefinition>(IEnumerable<ColumnDefinition>)Overloaded. Produces the set difference of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension MethodExcept<ColumnDefinition>(IEnumerable<ColumnDefinition>, IEqualityComparer<ColumnDefinition>)Overloaded. Produces the set difference of two sequences by using the specified IEqualityComparer<T> to compare values. (Defined by Enumerable.)
Public Extension MethodFirst<ColumnDefinition>()Overloaded. Returns the first element of a sequence. (Defined by Enumerable.)
Public Extension MethodFirst<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the first element in a sequence that satisfies a specified condition. (Defined by Enumerable.)
Public Extension MethodFirstOrDefault<ColumnDefinition>()Overloaded. Returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
Public Extension MethodFirstOrDefault<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>)Overloaded. Groups the elements of a sequence according to a specified key selector function. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>, IEqualityComparer<TKey>)Overloaded. Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>)Overloaded. Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TResult>(Func<ColumnDefinition, TKey>, Func<TKey, IEnumerable<ColumnDefinition>, TResult>)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>, IEqualityComparer<TKey>)Overloaded. Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TResult>(Func<ColumnDefinition, TKey>, Func<TKey, IEnumerable<ColumnDefinition>, TResult>, IEqualityComparer<TKey>)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TElement, TResult>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>, Func<TKey, IEnumerable<TElement>, TResult>)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. (Defined by Enumerable.)
Public Extension MethodGroupBy<ColumnDefinition, TKey, TElement, TResult>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>, Func<TKey, IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. (Defined by Enumerable.)
Public Extension MethodGroupJoin<ColumnDefinition, TInner, TKey, TResult>(IEnumerable<TInner>, Func<ColumnDefinition, TKey>, Func<TInner, TKey>, Func<ColumnDefinition, IEnumerable<TInner>, TResult>)Overloaded. Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. (Defined by Enumerable.)
Public Extension MethodGroupJoin<ColumnDefinition, TInner, TKey, TResult>(IEnumerable<TInner>, Func<ColumnDefinition, TKey>, Func<TInner, TKey>, Func<ColumnDefinition, IEnumerable<TInner>, TResult>, IEqualityComparer<TKey>)Overloaded. Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparer<T> is used to compare keys. (Defined by Enumerable.)
Public Extension MethodIntersect<ColumnDefinition>(IEnumerable<ColumnDefinition>)Overloaded. Produces the set intersection of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension MethodIntersect<ColumnDefinition>(IEnumerable<ColumnDefinition>, IEqualityComparer<ColumnDefinition>)Overloaded. Produces the set intersection of two sequences by using the specified IEqualityComparer<T> to compare values. (Defined by Enumerable.)
Public Extension MethodJoin<ColumnDefinition, TInner, TKey, TResult>(IEnumerable<TInner>, Func<ColumnDefinition, TKey>, Func<TInner, TKey>, Func<ColumnDefinition, TInner, TResult>)Overloaded. Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. (Defined by Enumerable.)
Public Extension MethodJoin<ColumnDefinition, TInner, TKey, TResult>(IEnumerable<TInner>, Func<ColumnDefinition, TKey>, Func<TInner, TKey>, Func<ColumnDefinition, TInner, TResult>, IEqualityComparer<TKey>)Overloaded. Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer<T> is used to compare keys. (Defined by Enumerable.)
Public Extension MethodLast<ColumnDefinition>()Overloaded. Returns the last element of a sequence. (Defined by Enumerable.)
Public Extension MethodLast<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the last element of a sequence that satisfies a specified condition. (Defined by Enumerable.)
Public Extension MethodLastOrDefault<ColumnDefinition>()Overloaded. Returns the last element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
Public Extension MethodLastOrDefault<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
Public Extension MethodLongCount<ColumnDefinition>()Overloaded. Returns an Int64 that represents the total number of elements in a sequence. (Defined by Enumerable.)
Public Extension MethodLongCount<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns an Int64 that represents how many elements in a sequence satisfy a condition. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>()Overloaded. Returns the maximum value in a generic sequence. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Nullable<Decimal>>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Nullable<Double>>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Double value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Int32>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int32 value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int32>>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Int64>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int64 value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int64>>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Single>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Single value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Nullable<Single>>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Single value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Double>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Double value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition>(Func<ColumnDefinition, Decimal>)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Decimal value. (Defined by Enumerable.)
Public Extension MethodMax<ColumnDefinition, TResult>(Func<ColumnDefinition, TResult>)Overloaded. Invokes a transform function on each element of a generic sequence and returns the maximum resulting value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>()Overloaded. Returns the minimum value in a generic sequence. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Nullable<Decimal>>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Nullable<Double>>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Double value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Int32>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int32 value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int32>>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Int64>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int64 value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int64>>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Single>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Single value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Nullable<Single>>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Single value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Double>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Double value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition>(Func<ColumnDefinition, Decimal>)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Decimal value. (Defined by Enumerable.)
Public Extension MethodMin<ColumnDefinition, TResult>(Func<ColumnDefinition, TResult>)Overloaded. Invokes a transform function on each element of a generic sequence and returns the minimum resulting value. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Public Extension MethodOrderBy<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>)Overloaded. Sorts the elements of a sequence in ascending order according to a key. (Defined by Enumerable.)
Public Extension MethodOrderBy<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>, IComparer<TKey>)Overloaded. Sorts the elements of a sequence in ascending order by using a specified comparer. (Defined by Enumerable.)
Public Extension MethodOrderByDescending<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>)Overloaded. Sorts the elements of a sequence in descending order according to a key. (Defined by Enumerable.)
Public Extension MethodOrderByDescending<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>, IComparer<TKey>)Overloaded. Sorts the elements of a sequence in descending order by using a specified comparer. (Defined by Enumerable.)
Public Extension MethodReverse<ColumnDefinition>Inverts the order of the elements in a sequence. (Defined by Enumerable.)
Public Extension MethodSelect<ColumnDefinition, TResult>(Func<ColumnDefinition, TResult>)Overloaded. Projects each element of a sequence into a new form. (Defined by Enumerable.)
Public Extension MethodSelect<ColumnDefinition, TResult>(Func<ColumnDefinition, Int32, TResult>)Overloaded. Projects each element of a sequence into a new form by incorporating the element's index. (Defined by Enumerable.)
Public Extension MethodSelectMany<ColumnDefinition, TResult>(Func<ColumnDefinition, IEnumerable<TResult>>)Overloaded. Projects each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence. (Defined by Enumerable.)
Public Extension MethodSelectMany<ColumnDefinition, TResult>(Func<ColumnDefinition, Int32, IEnumerable<TResult>>)Overloaded. Projects each element of a sequence to an IEnumerable<T>, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. (Defined by Enumerable.)
Public Extension MethodSelectMany<ColumnDefinition, TCollection, TResult>(Func<ColumnDefinition, Int32, IEnumerable<TCollection>>, Func<ColumnDefinition, TCollection, TResult>)Overloaded. Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element. (Defined by Enumerable.)
Public Extension MethodSelectMany<ColumnDefinition, TCollection, TResult>(Func<ColumnDefinition, IEnumerable<TCollection>>, Func<ColumnDefinition, TCollection, TResult>)Overloaded. Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. (Defined by Enumerable.)
Public Extension MethodSequenceEqual<ColumnDefinition>(IEnumerable<ColumnDefinition>)Overloaded. Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. (Defined by Enumerable.)
Public Extension MethodSequenceEqual<ColumnDefinition>(IEnumerable<ColumnDefinition>, IEqualityComparer<ColumnDefinition>)Overloaded. Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer<T>. (Defined by Enumerable.)
Public Extension MethodSingle<ColumnDefinition>()Overloaded. Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by Enumerable.)
Public Extension MethodSingle<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by Enumerable.)
Public Extension MethodSingleOrDefault<ColumnDefinition>()Overloaded. Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by Enumerable.)
Public Extension MethodSingleOrDefault<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by Enumerable.)
Public Extension MethodSkip<ColumnDefinition>Bypasses a specified number of elements in a sequence and then returns the remaining elements. (Defined by Enumerable.)
Public Extension MethodSkipWhile<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. (Defined by Enumerable.)
Public Extension MethodSkipWhile<ColumnDefinition>(Func<ColumnDefinition, Int32, Boolean>)Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Nullable<Decimal>>)Overloaded. Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Nullable<Double>>)Overloaded. Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Int32>)Overloaded. Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int32>>)Overloaded. Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Int64>)Overloaded. Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Nullable<Int64>>)Overloaded. Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Single>)Overloaded. Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Nullable<Single>>)Overloaded. Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Double>)Overloaded. Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodSum<ColumnDefinition>(Func<ColumnDefinition, Decimal>)Overloaded. Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension MethodTake<ColumnDefinition>Returns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.)
Public Extension MethodTakeWhile<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Returns elements from a sequence as long as a specified condition is true. (Defined by Enumerable.)
Public Extension MethodTakeWhile<ColumnDefinition>(Func<ColumnDefinition, Int32, Boolean>)Overloaded. Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension MethodToArray<ColumnDefinition>Creates an array from a IEnumerable<T>. (Defined by Enumerable.)
Public Extension MethodToDictionary<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function. (Defined by Enumerable.)
Public Extension MethodToDictionary<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>, IEqualityComparer<TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function and key comparer. (Defined by Enumerable.)
Public Extension MethodToDictionary<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>)Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to specified key selector and element selector functions. (Defined by Enumerable.)
Public Extension MethodToDictionary<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>, IEqualityComparer<TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function, a comparer, and an element selector function. (Defined by Enumerable.)
Public Extension MethodToList<ColumnDefinition>Creates a List<T> from an IEnumerable<T>. (Defined by Enumerable.)
Public Extension MethodToLookup<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>)Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function. (Defined by Enumerable.)
Public Extension MethodToLookup<ColumnDefinition, TKey>(Func<ColumnDefinition, TKey>, IEqualityComparer<TKey>)Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function and key comparer. (Defined by Enumerable.)
Public Extension MethodToLookup<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>)Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to specified key selector and element selector functions. (Defined by Enumerable.)
Public Extension MethodToLookup<ColumnDefinition, TKey, TElement>(Func<ColumnDefinition, TKey>, Func<ColumnDefinition, TElement>, IEqualityComparer<TKey>)Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function, a comparer and an element selector function. (Defined by Enumerable.)
Public Extension MethodUnion<ColumnDefinition>(IEnumerable<ColumnDefinition>)Overloaded. Produces the set union of two sequences by using the default equality comparer. (Defined by Enumerable.)
Public Extension MethodUnion<ColumnDefinition>(IEnumerable<ColumnDefinition>, IEqualityComparer<ColumnDefinition>)Overloaded. Produces the set union of two sequences by using a specified IEqualityComparer<T>. (Defined by Enumerable.)
Public Extension MethodWhere<ColumnDefinition>(Func<ColumnDefinition, Boolean>)Overloaded. Filters a sequence of values based on a predicate. (Defined by Enumerable.)
Public Extension MethodWhere<ColumnDefinition>(Func<ColumnDefinition, Int32, Boolean>)Overloaded. Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension MethodZip<ColumnDefinition, TSecond, TResult>Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results. (Defined by Enumerable.)
Top

  NameDescription
Explicit interface implemetationPrivate methodICollection.CopyToInfrastructure. For a description of this member, see ICollection.CopyTo.
Explicit interface implemetationPrivate methodIEnumerable<ColumnDefinition>.GetEnumeratorInfrastructure. For a description of this member, see IEnumerable<T>.GetEnumerator.
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorInfrastructure. For a description of this member, see IEnumerable.GetEnumerator.
Explicit interface implemetationPrivate methodIList.AddInfrastructure. For a description of this member, see IList.Add.
Explicit interface implemetationPrivate methodIList.ContainsInfrastructure. For a description of this member, see IList.Contains.
Explicit interface implemetationPrivate methodIList.IndexOfInfrastructure. For a description of this member, see IList.IndexOf.
Explicit interface implemetationPrivate methodIList.InsertInfrastructure. For a description of this member, see IList.Insert.
Explicit interface implemetationPrivate propertyIList.IsFixedSizeInfrastructure. For a description of this member, see IList.IsFixedSize.
Explicit interface implemetationPrivate propertyIList.ItemInfrastructure. For a description of this member, see IList.Item.
Explicit interface implemetationPrivate methodIList.RemoveInfrastructure. For a description of this member, see IList.Remove.
Top

This example shows how to use the methods in the ColumnDefinitionCollection and RowDefinitionCollection classes to perform actions like adding, clearing, or counting the contents of rows or columns. For example, you can Add, Clear, or Count the items that are included in a ColumnDefinition or RowDefinition.

The following example creates a Grid element with a Name of grid1. The Grid contains a StackPanel that holds Button elements, each controlled by a different collection method. When you click a Button, it activates a method call in the code-behind file.

        <Grid DockPanel.Dock="Top" HorizontalAlignment="Left" Name="grid1" ShowGridLines="true" Width="625" Height="400" Background="#b0e0e6">
          <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="addCol">Add Column</Button>
            <Button Width="125" Click="addRow">Add Row</Button>
            <Button Width="125" Click="clearCol">Clear All Columns</Button>
            <Button Width="125" Click="clearRow">Clear All Rows</Button>
            <Button Width="125" Click="removeCol">Remove One Column</Button>
        </StackPanel>
        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
            <Button Width="125" Click="removeRow">Remove One Row</Button>
            <Button Width="125" Click="colCount">How Many Columns?</Button>
            <Button Width="125" Click="rowCount">How Many Rows?</Button>
            <Button Width="125" Click="rem5Col">Remove 5 Columns</Button>
            <Button Width="125" Click="rem5Row">Remove 5 Rows</Button>			
		    </StackPanel>
        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
            <Button Width="125" Click="containsRow">Contains Row?</Button>
            <Button Width="125" Click="containsCol">Contains Column?</Button>
            <Button Width="125" Click="insertRowAt">Insert Row</Button>
            <Button Width="125" Click="insertColAt">Insert Column</Button>
            <Button Width="125" Click="colReadOnly">IsReadOnly?</Button>
        </StackPanel>    

This example defines a series of custom methods, each corresponding to a Click event in the Extensible Application Markup Language (XAML) file. You can change the number of columns and rows in the Grid in several ways, which includes adding or removing rows and columns; and counting the total number of rows and columns. To prevent ArgumentOutOfRangeException and ArgumentException exceptions, you can use the error-checking functionality that the RemoveRange method provides.

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

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

        private void addCol(object sender, RoutedEventArgs e) 
        {
            colDef1 = new ColumnDefinition();
            grid1.ColumnDefinitions.Add(colDef1);
        }

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

        private void clearCol(object sender, RoutedEventArgs e)
        {
            grid1.ColumnDefinitions.Clear();
        }

        private void clearRow(object sender, RoutedEventArgs e)
        {
            grid1.RowDefinitions.Clear();
        }

        private void removeCol(object sender, RoutedEventArgs e)
        {
            if (grid1.ColumnDefinitions.Count <= 0)
            {
                tp1.Text = "No More Columns to Remove!";
            }
            else
            {
                grid1.ColumnDefinitions.RemoveAt(0);
            }
        }

        private void removeRow(object sender, RoutedEventArgs e)
        {
            if (grid1.RowDefinitions.Count <= 0)
            {
                tp1.Text = "No More Rows to Remove!";
            }
            else
            {
                grid1.RowDefinitions.RemoveAt(0);
            }
        }

        private void colCount(object sender, RoutedEventArgs e)
        {
            tp2.Text = "The current number of Columns is: " + grid1.ColumnDefinitions.Count;
        }

        private void rowCount(object sender, RoutedEventArgs e)
        {
            tp2.Text = "The current number of Rows is: " + grid1.RowDefinitions.Count;
        }

        private void rem5Col(object sender, RoutedEventArgs e)
        {
            if (grid1.ColumnDefinitions.Count < 5)
            {
                tp1.Text = "There aren't five Columns to Remove!";
            }
            else
            {
                grid1.ColumnDefinitions.RemoveRange(0,5);
            }
        }

        private void rem5Row(object sender, RoutedEventArgs e)
        {
            if (grid1.RowDefinitions.Count < 5)
            {
                tp1.Text = "There aren't five Rows to Remove!";
            }
            else
            {
                grid1.RowDefinitions.RemoveRange(0, 5);
            }
        }

        private void containsRow(object sender, RoutedEventArgs e)
        {
            if (grid1.RowDefinitions.Contains(rowDef1))
            {
                tp2.Text = "Grid Contains RowDefinition rowDef1";
            }
            else
            {
                tp2.Text = "Grid Does Not Contain RowDefinition rowDef1";
            }
        }

        private void containsCol(object sender, RoutedEventArgs e)
        {
            if (grid1.ColumnDefinitions.Contains(colDef1))
            {
                tp3.Text = "Grid Contains ColumnDefinition colDef1";
            }
            else
            {
                tp3.Text = "Grid Does Not Contain ColumnDefinition colDef1";
            }
        }

        private void colReadOnly(object sender, RoutedEventArgs e)
        {
            tp4.Text = "RowDefinitionsCollection IsReadOnly?: " + grid1.RowDefinitions.IsReadOnly.ToString();
            tp5.Text = "ColumnDefinitionsCollection IsReadOnly?: " + grid1.ColumnDefinitions.IsReadOnly.ToString();
        }

        private void insertRowAt(object sender, RoutedEventArgs e)
        {
            rowDef1 = new RowDefinition();
            grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1);
            tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString();
        }

        private void insertColAt(object sender, RoutedEventArgs e)
        {
            colDef1 = new ColumnDefinition();
            grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1);
            tp2.Text = "ColumnDefinition added at index position " + grid1.ColumnDefinitions.IndexOf(colDef1).ToString();
        }
    }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft