BinaryPowerTabPageCollection
The pages of a BinaryPowerTabStrip, in tab order, as returned by
BinaryPowerTabStrip.TabPages.
public class BinaryPowerTabPageCollection : BinaryPowerTabPageCollectionBase<BinaryPowerTabPage>
Inherits from / implements: BinaryPowerTabPageCollectionBase<BinaryPowerTabPage>
Remarks
Adding a page here adds its tab to the strip and removing it removes the tab; the order of the collection is the order of the headers. A page is held only once – adding or inserting a page that is already here does nothing.
Removing a page here does not change the strip's selection;
BinaryPowerTabStrip.RemoveTab removes a tab and selects a neighbour.
Examples
tabs.TabPages.AddRange(new[]
{
new BinaryPowerTabPage { Text = "Accounts" },
new BinaryPowerTabPage { Text = "Contacts" },
new BinaryPowerTabPage { Text = "Opportunities" }
});
BinaryPowerTabPage contacts = tabs.TabPages[1];
tabs.TabPages.MoveTo(0, contacts); // Contacts becomes the first tabMembers at a glance
| Constructors | |
|---|---|
BinaryPowerTabPageCollection | Creates an empty collection. A strip creates its own; see
BinaryPowerTabStrip.TabPages. |
| Properties | |
FirstVisibleTabPage | Gets the first page whose BinaryPowerTabPage.Visible is on. |
Item | Gets or sets the page at a position in the collection. |
LastButOneVisibleTabPage | Gets the page just before the last visible page. |
LastVisibleTabPage | Gets the last page whose BinaryPowerTabPage.Visible is on, searching back from the
end. |
TabPagesCurrentlyVisible | Gets how many pages have BinaryPowerTabPage.Visible on. |
| Methods | |
Add | Adds a page as the last tab, unless it is already in the collection. |
AddRange | Adds several pages, in order, as the last tabs. |
Assign | Replaces the contents of this collection with new, empty pages copied from another collection. Used by the strip itself; not intended for application code. |
BeginUpdate | Starts a batch of changes, at the end of which EndUpdate raises one
Refresh notification. |
Contains | Tells whether a page is in the collection. |
EndUpdate | Ends a batch begun with BeginUpdate, and when the outermost batch ends raises
CollectionChanged once with
Refresh and no page. |
IndexOf | Gets the position of a page among the tabs. |
Insert | Inserts a page at a position among the tabs, unless it is already in the collection. |
MoveTo | Moves a page to a new position. |
OnClear | Removes the pages one at a time, from the last, each raising
Remove, then raises one
Refresh. |
OnCollectionChanged | Raises the CollectionChanged event. |
OnInsertComplete | Starts listening to the new page's BinaryPowerTabPage.TabPageChanged event, and raises
CollectionChanged with Add. |
OnRemove | Raises the base class's BinaryPowerTabPageCollectionBase.Removing
event, stops listening to the page, and raises CollectionChanged with
Remove. |
OnTabPageChanged | Raises CollectionChanged with
Refresh when one of the pages changes, so
the strip lays its headers out again. |
Remove | Removes a page, and so its tab. A page that is not in the collection is ignored. |
| Events | |
CollectionChanged | Occurs when a page is added to or removed from the collection, or changes. |
Constructors
BinaryPowerTabPageCollection
Creates an empty collection. A strip creates its own; see
BinaryPowerTabStrip.TabPages.
Properties
FirstVisibleTabPage
Gets the first page whose BinaryPowerTabPage.Visible is on.
- Value
- The page, or
nullif no page is visible.
Item
Gets or sets the page at a position in the collection.
- Value
- The page, or
nullwhen getting a position that is out of range; no exception is thrown.
Parameters
index- The zero-based position.
Remarks
Replacing a page through the setter does not raise CollectionChanged, so the
strip is not told; remove the old page and Insert the new one instead.
LastButOneVisibleTabPage
Gets the page just before the last visible page.
- Value
- The page before
LastVisibleTabPagein the collection, whether or not it is visible itself;nullwhenLastVisibleTabPageis.
LastVisibleTabPage
Gets the last page whose BinaryPowerTabPage.Visible is on, searching back from the
end.
- Value
- The page, or
nullif none is found. The search stops before the first page, so when only the first page is visible this isnull.
TabPagesCurrentlyVisible
Gets how many pages have BinaryPowerTabPage.Visible on.
- Value
- The number of visible pages, whether or not their headers are on show.
Methods
Add
Adds a page as the last tab, unless it is already in the collection.
Parameters
tabPageItem- The page to add.
Returns
The page's zero-based position: where it was added, or where it already was.
Exceptions
System.ArgumentNullExceptiontabPageItemisnull.
AddRange
Adds several pages, in order, as the last tabs.
Parameters
tabPageItems- The pages to add. Must not be
nullor containnull.
Remarks
Assign
Replaces the contents of this collection with new, empty pages copied from another collection. Used by the strip itself; not intended for application code.
Parameters
collection- The collection to copy.
Remarks
Each new page copies only BinaryPowerTabPage.Visible,
BinaryPowerTabPage.Text and Tag – not the
page's controls or appearance.
BeginUpdate
Remarks
Each call must be matched by a call to EndUpdate; batches may nest. The
individual add and remove notifications are still raised during the batch.
Contains
Tells whether a page is in the collection.
Parameters
tabPageItem- The page to look for.
Returns
true if the page is one of the strip's tabs.
EndUpdate
Ends a batch begun with BeginUpdate, and when the outermost batch ends raises
CollectionChanged once with
Refresh and no page.
IndexOf
Gets the position of a page among the tabs.
Parameters
tabPageItem- The page to look for.
Returns
Its zero-based index, or -1 if it is not in the collection.
Insert
Inserts a page at a position among the tabs, unless it is already in the collection.
Parameters
index- The zero-based position, from 0 to
Count. tabPageItem- The page to insert.
Exceptions
System.ArgumentOutOfRangeExceptionindexis negative or greater thanCount.
MoveTo
Moves a page to a new position.
Parameters
newIndex- The zero-based position the page is to take, from 0 to
Count - 1. tabPageItem- The page to move.
Returns
The page, or null if it is not in the collection.
Exceptions
System.ArgumentOutOfRangeExceptionnewIndexis out of range. The page has already been taken out of the collection by then.
Remarks
OnClear
Remarks
Does not raise the base class's
BinaryPowerTabPageCollectionBase.Clearing event.
OnCollectionChanged
Raises the CollectionChanged event.
Parameters
e- The event data.
OnInsertComplete
Starts listening to the new page's BinaryPowerTabPage.TabPageChanged event, and raises
CollectionChanged with Add.
Parameters
index- Where the page went.
tabPageItem- The page.
Remarks
Does not raise the base class's
BinaryPowerTabPageCollectionBase.Inserted event.
OnRemove
Raises the base class's BinaryPowerTabPageCollectionBase.Removing
event, stops listening to the page, and raises CollectionChanged with
Remove.
Parameters
index- Where the page is.
tabPageItem- The page about to be removed.
OnTabPageChanged
Raises CollectionChanged with
Refresh when one of the pages changes, so
the strip lays its headers out again.
Parameters
sender- The page that changed.
e- Not used.
Remove
Removes a page, and so its tab. A page that is not in the collection is ignored.
Parameters
tabPageItem- The page to remove. It is not disposed.
Remarks
The strip's BinaryPowerTabStrip.SelectedTabPage is not changed; use
BinaryPowerTabStrip.RemoveTab to remove a tab and select a neighbour.
Events
CollectionChanged
Occurs when a page is added to or removed from the collection, or changes.
Remarks
Action is
Add after a page is added,
Remove just before one is removed, and
Refresh when a page's
BinaryPowerTabPage.Visible changes or after a batch (AddRange,
Assign, Clear).
Element is the page, or
null after a batch.
The strip listens to this event to keep its tabs in step; it is raised again to the
application as BinaryPowerTabStrip.TabPageSelectionChanged.