-
Notifications
You must be signed in to change notification settings - Fork 3
Utils.LimitableStringCollection
Back to home | Back to Reference | View raw text
A string collection where a limit can be applied to the number of items allowed. This collection can be observed via the CollectionChanged event.
flowchart LR
classDef interfaceStyle stroke-dasharray: 5 5;
classDef abstractStyle stroke-width:4px
subgraph SolidShineUi.Utils
SolidShineUi.Utils.LimitableStringCollection[[LimitableStringCollection]]
end
subgraph System.Collections.ObjectModel
System.Collections.ObjectModel.ObservableCollection_1[[ObservableCollection]]
end
System.Collections.ObjectModel.ObservableCollection_1 --> SolidShineUi.Utils.LimitableStringCollection
Type | Name | Methods |
---|---|---|
int |
MaxCount Get or set the maximum number of items allowed for this collection. If the maximum count is less than 0, then the collection is allowed to grow to any size without a limit. |
get, set |
Returns | Name |
---|---|
void |
Add (string item)Adds an object to the end of this collection. |
void |
Insert (int index, string item)Insert an object into the collection at the specified index. |
A string collection where a limit can be applied to the number of items allowed. This collection can be observed via the CollectionChanged event.
-
ObservableCollection
<string
>
public LimitableStringCollection()
Create a LimitableStringCollection.
public LimitableStringCollection(int maxCount)
Type | Name | Description |
---|---|---|
int |
maxCount | The maximum number of items allowed in this collection. |
Create a LimitableStringCollection, with a max limit of items preset.
public void Add(string item)
Type | Name | Description |
---|---|---|
string |
item | The item to add. |
Adds an object to the end of this collection.
If the LimitableStringCollection's ItemAdding event is handled, it is possible that the addition of this item could be cancelled. If the item being added would bring the count over the maximum count of items allowed (via LimitableStringCollection.MaxCount ), then this item replaces the last item already in the collection (with the last item being removed before this item is added in).
public void Insert(int index, string item)
Type | Name | Description |
---|---|---|
int |
index | The zero-based index at which the item should be inserted. |
string |
item | The item to add. |
Insert an object into the collection at the specified index.
If the LimitableStringCollection's ItemAdding event is handled, it is possible that the insertion of this item could be cancelled. If the item being inserted would bring the count over the maximum count of items allowed (via LimitableStringCollection.MaxCount ), then this item is inserted after the current last item in the collection is removed.
public int MaxCount { get; set; }
Get or set the maximum number of items allowed for this collection. If the maximum count is less than 0, then the collection is allowed to grow to any size without a limit.
public event ItemAddingStringEventHandler ItemAdding
Raised prior to an item being added to this collection, with the ability to cancel adding the item.
public delegate void ItemAddingStringEventHandler(object sender, ItemAddingStringEventArgs e)
Type | Name | Description |
---|---|---|
object |
sender | |
ItemAddingStringEventArgs |
e |
Generated with ModularDoc