Class ReportItemBase.ItemCollection
Represents a collection of ReportItemBase objects.
Inheritance
Namespace: Telerik.Reporting
Assembly: Telerik.Reporting.dll
Syntax
public class ItemCollection : Collection<ReportItemBase>, IList<ReportItemBase>, ICollection<ReportItemBase>, IList, ICollection, IReadOnlyList<ReportItemBase>, IReadOnlyCollection<ReportItemBase>, IEnumerable<ReportItemBase>, IEnumerable
Remarks
The System.Collections.ObjectModel.Collection`1.Add(`0), System.Collections.ObjectModel.Collection`1.Remove(`0), and System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32) methods enable you to add and remove individual items from the collection. You can also use the AddRange(ReportItemBase[]) or System.Collections.ObjectModel.Collection`1.Clear methods to add or remove all the items from the collection. You can determine if a ReportItemBase is a member of the collection by passing the item into the System.Collections.ObjectModel.Collection`1.Contains(`0) method. To get the index value of the location of a ReportItemBase in the collection, pass the item into the System.Collections.ObjectModel.Collection`1.IndexOf(`0) method. The collection can be copied into an array by calling the System.Collections.ObjectModel.Collection`1.CopyTo(`0[],System.Int32) method.
Constructors
ItemCollection(ReportItemBase)
Initializes a new instance of the ReportItemBase.ItemCollection class.
Declaration
public ItemCollection(ReportItemBase owner)
Parameters
ReportItemBase
owner
A ReportItemBase representing the report item that owns the report item collection. |
Properties
Item[String]
Returns the ReportItemBase with the specified key in the collection.
Declaration
public virtual ReportItemBase this[string key] { get; }
Parameters
System.String
key
The name of the report item to retrieve from the report item collection. |
Property Value
ReportItemBase
The ReportItemBase with the specified key in the collection. |
Methods
AddRange(ReportItemBase[])
Adds an array of report item objects to the collection.
Declaration
public virtual void AddRange(ReportItemBase[] items)
Parameters
ReportItemBase[]
items
An array of ReportItemBase objects to add to the collection. |
Remarks
The ReportItemBase objects contained in the items array are appended to the end of the collection.
You can use the AddRange method to quickly add a group of ReportItemBase objects to the collection instead of manually adding each ReportItemBase to the collection using the System.Collections.ObjectModel.Collection`1.Add(`0) method.
To remove a ReportItemBase that you previously added, use the System.Collections.ObjectModel.Collection`1.Remove(`0), System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32), or System.Collections.ObjectModel.Collection`1.Clear methods.
ClearItems()
Declaration
protected override void ClearItems()
Overrides
ContainsKey(String)
Determines whether the ReportItemBase.ItemCollection contains an item with the specified key.
Declaration
public virtual bool ContainsKey(string key)
Parameters
System.String
key
The key to locate in the ReportItemBase.ItemCollection. |
Returns
System.Boolean
true if the ReportItemBase.ItemCollection contains an item with the specified key; otherwise, false. |
Remarks
The Name property of a ReportItemBase corresponds to the key for a ReportItemBase in the ReportItemBase.ItemCollection.
Find(String, Boolean)
Searches for report items by their Name property and builds an array of all the report items that match.
Declaration
public virtual ReportItemBase[] Find(string key, bool recursive)
Parameters
System.String
key
The key to locate in the ReportItemBase.ItemCollection. |
System.Boolean
recursive
true to search all child report items; otherwise, false. |
Returns
ReportItemBase[]
An array of type ReportItemBase containing the matching report items. |
Exceptions
System.ArgumentNullException
The key parameter is null or empty. |
Find(Type)
Searches for report items by their Type and builds an array of all the items that match.
Declaration
public virtual ReportItemBase[] Find(Type type)
Parameters
System.Type
type
The System.Type to search for. |
Returns
ReportItemBase[]
An array of type ReportItemBase containing the matching report items. |
Find(Type, Boolean)
Searches for report items by their Type and builds an array of all the items that match.
Declaration
public virtual ReportItemBase[] Find(Type type, bool recursive)
Parameters
System.Type
type
The System.Type to search for. |
System.Boolean
recursive
A value indicating whether to search all children recursively. |
Returns
ReportItemBase[]
An array of type ReportItemBase containing the matching report items. |
FindItem(Type)
Searches the collection for a report item of the specified type.
Declaration
public virtual ReportItemBase FindItem(Type type)
Parameters
System.Type
type
The System.Type to search for. |
Returns
ReportItemBase
The first ReportItemBase in the collection that matches the given System.Type. If no item in the collection matches the given System.Type the method returns null. |
GetChildIndex(ReportItemBase)
Retrieves the index of a report item within the item collection.
Declaration
public int GetChildIndex(ReportItemBase child)
Parameters
ReportItemBase
child
The ReportItemBase to search for in the item collection. |
Returns
System.Int32
A zero-based index value that represents the location of the specified child report item within the item collection. |
GetChildIndex(ReportItemBase, Boolean)
Retrieves the index of the specified child report item within the item collection, and optionally raises an exception if the specified report item is not within the item collection.
Declaration
public virtual int GetChildIndex(ReportItemBase child, bool throwException)
Parameters
ReportItemBase
child
The ReportItemBase to search for in the item collection. |
System.Boolean
throwException
true to throw an exception if the ReportItemBase specified in the child parameter is not an item in the ReportItemBase.ItemCollection; otherwise, false. |
Returns
System.Int32
A zero-based index value that represents the location of the specified child report item within the item collection; otherwise -1 if the specified ReportItemBase is not found in the ReportItemBase.ItemCollection. |
Exceptions
System.ArgumentException
The child is not contained in the collection and the throwException parameter is true. |
IndexOfKey(String)
Retrieves the index of the first occurrence of the specified item within the collection.
Declaration
public virtual int IndexOfKey(string key)
Parameters
System.String
key
The name of the report item to search for. |
Returns
System.Int32
The zero-based index of the first occurrence of the report item with the specified name in the collection. |
Remarks
The key comparison is not case-sensitive. If the key parameter is a null reference (Nothing in Visual Basic) or an empty string, or an item with the specified key is not found, IndexOfKey returns -1.
The Name property of a ReportItemBase corresponds to the key for a ReportItemBase in the ReportItemBase.ItemCollection.
InsertItem(Int32, ReportItemBase)
Overrides the System.Collections.ObjectModel.Collection<T>.InsertItem(System.Int32, T) method.
Declaration
protected override void InsertItem(int index, ReportItemBase item)
Parameters
System.Int32
index
The zero-based index at which to insert value. |
ReportItemBase
item
|
Overrides
RemoveByKey(String)
Removes the child report item with the specified key.
Declaration
public virtual void RemoveByKey(string key)
Parameters
System.String
key
The name of the child report item to remove. |
Remarks
The Name property of a ReportItemBase corresponds to the key for a ReportItemBase in the ReportItemBase.ItemCollection.
RemoveItem(Int32)
Overrides the System.Collections.ObjectModel.Collection<T>.RemoveItem(System.Int32) method.
Declaration
protected override void RemoveItem(int index)
Parameters
System.Int32
index
The zero-based index at which value can be found. |
Overrides
SetItem(Int32, ReportItemBase)
Declaration
protected override void SetItem(int index, ReportItemBase item)
Parameters
System.Int32
index
|
ReportItemBase
item
|