Class ListBarItem
A BarItem derived class that expands into a list when shown.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools.XPMenus
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public class ListBarItem : BarItemEx, IChangeNotifyingItem, ICustomTypeDescriptor, IDataBindingSupport, ISerializable, ICloneable
Remarks
Use this class when you have to represent a dynamic list of BarItems. When shown this bar item will be replaced by a numbered list of BarItems based on the supplied ChildCaptions list and when one of the items gets clicked by the user a Click event is thrown by this instance with the ListBarItemClickedEventArgs args.
This also means you should not use a ListBarItem in a tool bar. If you do so, you might see unpredictable behavior. The user will automatically be prevented from dropping a ListBarItem into a tool bar during customization.
Note that the Click event handler will be called with a ListBarItemClickedEventArgs argument containing data pertaining to the child item that was clicked. Which means you should cast the regular EventArgs argument into this type in your handler.
A typical example is the Most Recently Used Files list. The framework also internally uses this to represent the MDI Child list(MdiListBarItem).
Examples
Take a look at our XPMenus samples under the Tools\Samples\Menus Package folder for usage example.
Constructors
ListBarItem()
Creates an instance of the ListBarItem class.
Declaration
public ListBarItem()
ListBarItem(SerializationInfo, StreamingContext)
Declaration
protected ListBarItem(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | |
System.Runtime.Serialization.StreamingContext | context |
Properties
CheckedIndices
Returns the items in the ChildCaptions list that should be marked as checked.
Declaration
public virtual IntList CheckedIndices { get; }
Property Value
Type | Description |
---|---|
IntList | A list of indices into the ChildCaptions list. |
Remarks
This list will be used to determine the checked state of the expanded BarItems.
ChildCaptions
Returns the captions for the expanded bar items.
Declaration
public virtual StringCollection ChildCaptions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Specialized.StringCollection | Represents the StringCollection that will hold the list of captions. |
ExpandedBarItems
Returns a list of expanded BarItems.
Declaration
public ArrayList ExpandedBarItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.ArrayList | An ArrayList if the expanded BarItems are currently shown. Null (or Nothing) otherwise. |
Remarks
This property will return a non-null value only when queried from the AfterExpand event handler. It's recommended that you do not hold any references to the BarItems returned by this property.
Tags
Returns the list of application specific values corresponding to the ChildCaptions entries.
Declaration
public virtual ArrayList Tags { get; }
Property Value
Type | Description |
---|---|
System.Collections.ArrayList | The list that contains the application specific values. |
UseNumberedList
Indicates whether to use numbers in the expanded list.
Declaration
public bool UseNumberedList { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True to include numbers; false otherwise. |
Methods
AddCheckIndices(Int32)
Declaration
public void AddCheckIndices(int str)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | str |
AddChildCaptions(String)
Declaration
public void AddChildCaptions(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str |
Clone()
Creates a clone of this ListBarItem instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | An object that has similar properties to this ListBarItem. |
Overrides
Remarks
Creates a new instance of ListBarItem and calls the CopyTo(BarItem) method to copy over properties.
CopyTo(BarItem)
Copies the properties of this ListBarItem into the specified ListBarItem.
Declaration
public override void CopyTo(BarItem barItem)
Parameters
Type | Name | Description |
---|---|---|
BarItem | barItem | The ListBarItem where the values should be copied to. |
Overrides
Remarks
The tags will be copied over only if the actual objects are cloneable (implements IClonable).
GetObjectData(SerializationInfo, StreamingContext)
Declaration
public override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | |
System.Runtime.Serialization.StreamingContext | context |
Overrides
InsertChildCaptions(Int32, String)
Declaration
public void InsertChildCaptions(int index, string str)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.String | str |
ItemClicked(Int32, BarItem)
Declaration
protected virtual void ItemClicked(int index, BarItem item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
BarItem | item |
OnAfterExpand(EventArgs)
Raises the AfterExpand event.
Declaration
protected virtual void OnAfterExpand(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnBeforeExpand()
Called before the item gets expanded by its parent.
Declaration
protected virtual void OnBeforeExpand()
Remarks
This is a good place to fill the ChildCaptions list with appropriate values.
PopupClosed()
Declaration
protected virtual void PopupClosed()
PostExpand(ParentBarItem, Int32, Int32)
Called after this item's parent expands this item.
Declaration
protected virtual void PostExpand(ParentBarItem parent, int firstChildIndex, int lastChildIndex)
Parameters
Type | Name | Description |
---|---|---|
ParentBarItem | parent | The parent where this item is hosted. |
System.Int32 | firstChildIndex | The index into the parent representing the BarItem corresponding to the first item in the ChildCaptions list. |
System.Int32 | lastChildIndex | The index into the parent representing the BarItem corresponding to the last item in the ChildCaptions list. |
Remarks
With the reference to the parent, you can insert items if necessary before the parent gets shown.
RemoveChildCaptions(Int32)
Declaration
public void RemoveChildCaptions(int str)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | str |
RemoveChildCaptions(String)
Declaration
public void RemoveChildCaptions(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str |
UpdateCheckedStates()
Updates the checked state of the expanded list BarItems. This method is usable only when the ListBarItem is being shown in a submenu.
Declaration
public virtual void UpdateCheckedStates()
Events
AfterExpand
Occurs after the expansion of the Captions into BarItems.
Declaration
public event EventHandler AfterExpand
Event Type
Type |
---|
System.EventHandler |
Remarks
The handler for this event is a good place to access the expanded BarItems and set some properties on it. Note that these expanded items will be disposed when the parent menu is hidden.
BeforeExpand
Occurs before the expansion of the Captions into BarItems. This is a good place to delay-insert Captions into the ChildCaptions list.
Declaration
public event EventHandler BeforeExpand
Event Type
Type |
---|
System.EventHandler |
Explicit Interface Implementations
ICloneable.Clone()
Declaration
object ICloneable.Clone()
Returns
Type |
---|
System.Object |