Skip to main content
Version: 4.1

ListBoxExtensions

Namespace: Wisej.Web.Markup

Assembly: Wisej.Framework (4.1.0.0)

Adds fluent markup extension methods to the ListBox class.

public class ListBoxExtensions

Methods

Static member HorizontalScrollbar<TListBox>(listBox, value)

Sets the HorizontalScrollbar property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the HorizontalScrollbar property.
valueBooleanA boolean indicating whether a horizontal scrollbar is shown.

Returns: TListBox. The modified list box with the updated HorizontalScrollbar property.

This method allows you to specify whether a horizontal scrollbar should be shown for the list box.


myListBox.HorizontalScrollbar(true);

Static member IncrementalSelection<TListBox>(listBox, value)

Sets the IncrementalSelection property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the IncrementalSelection property.
valueBooleanA boolean indicating whether incremental selection is enabled.

Returns: TListBox. The modified list box with the updated IncrementalSelection property.

This method allows you to enable or disable incremental selection for the list box.


myListBox.IncrementalSelection(true);

Static member ItemHeight<TListBox>(listBox, itemHeight)

Sets the ItemHeight property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the ItemHeight property.
itemHeightInt32The height of each item in the list box.

Returns: TListBox. The modified list box with the updated ItemHeight property.

This method allows you to specify the height of each item in the list box.


myListBox.ItemHeight(20);

Static member Items<TListBox>(listBox, items)

Adds the specified items to the Items collection of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box to which the items should be added.
itemsObject[]An array of items to add to the list box.

Returns: TListBox. The modified list box with the added items.

This method allows you to add multiple items to the list box in one call.


myListBox.Items("Item1", "Item2", "Item3");

Static member LazyLoading<TListBox>(listBox, value)

Sets the LazyLoading property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the LazyLoading property.
valueBooleanA boolean indicating whether lazy loading is enabled.

Returns: TListBox. The modified list box with the updated LazyLoading property.

This method allows you to enable or disable lazy loading for the list box.


myListBox.LazyLoading(true);

Static member OnSelectedIndexChanged<TListBox>(listBox, action)

Attaches an event handler for the SelectedIndexChanged event of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box to attach the event handler to.
actionAction<TListBox>An action to execute when the SelectedIndex property changes.

Returns: TListBox. The modified list box with the attached SelectedIndexChanged event handler.

This method allows you to execute a custom action whenever the SelectedIndex property of the list box changes.


myListBox.OnSelectedIndexChanged(lb =>
{
AlertBox.Show("Selected index changed!");
});

Static member OnSortedChanged<TListBox>(listBox, action)

Attaches an event handler for the SortedChanged event of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box to attach the event handler to.
actionAction<TListBox>An action to execute when the Sorted property changes.

Returns: TListBox. The modified list box with the attached SortedChanged event handler.

This method allows you to execute a custom action whenever the Sorted property of the list box changes.


myListBox.OnSortedChanged(lb =>
{
AlertBox.Show("Sorted property changed!");
});

Static member OnToolClick<TListBox>(listBox, action)

Attaches an event handler for the ToolClick event of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box to attach the event handler to.
actionAction<TListBox, ToolClickEventArgs>An action to execute when a tool in the list box is clicked.

Returns: TListBox. The modified list box with the attached ToolClick event handler.

This method allows you to execute a custom action whenever a tool in the list box is clicked.


myListBox.OnToolClick((lb, args) =>
{
AlertBox.Show("Tool clicked!");
});

Static member Orientation<TListBox>(listBox, orientation)

Sets the Orientation property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the Orientation property.
orientationOrientationThe Orientation to set for the list box.

Returns: TListBox. The modified list box with the updated Orientation property.

This method allows you to set the orientation for the list box, which determines how items are displayed.


myListBox.Orientation(Orientation.Horizontal);

Static member RightClickSelection<TListBox>(listBox, value)

Sets the RightClickSelection property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the RightClickSelection property.
valueBooleanA boolean indicating whether right-click selection is enabled.

Returns: TListBox. The modified list box with the updated RightClickSelection property.

This method allows you to enable or disable right-click selection for the list box.


myListBox.RightClickSelection(true);

Static member ScrollAlwaysVisible<TListBox>(listBox, value)

Sets the ScrollAlwaysVisible property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the ScrollAlwaysVisible property.
valueBooleanA boolean indicating whether the scrollbar is always visible.

Returns: TListBox. The modified list box with the updated ScrollAlwaysVisible property.

This method allows you to ensure the scrollbar is always visible, regardless of the number of items.


myListBox.ScrollAlwaysVisible(true);

Static member SelectedItem<TListBox>(listBox, selectedItem)

Sets the SelectedItem property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the SelectedItem property.
selectedItemObjectThe item to select in the list box.

Returns: TListBox. The modified list box with the updated SelectedItem property.

This method allows you to specify the selected item in the list box.


myListBox.SelectedItem(item);

Static member SelectionMode<TListBox>(listBox, selectionMode)

Sets the SelectionMode property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the SelectionMode property.
selectionModeSelectionModeThe SelectionMode to set for the list box.

Returns: TListBox. The modified list box with the updated SelectionMode property.

This method allows you to specify the selection mode for the list box.


myListBox.SelectionMode(SelectionMode.MultiExtended);

Static member Sorted<TListBox>(listBox, value)

Sets the Sorted property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the Sorted property.
valueBooleanA boolean indicating whether the list box is sorted.

Returns: TListBox. The modified list box with the updated Sorted property.

This method allows you to specify whether the items in the list box should be sorted automatically.


myListBox.Sorted(true);

Static member Tools<TListBox>(listBox, items)

Adds the specified tools to the Tools collection of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box to which the tools should be added.
itemsComponentTool[]An array of tools to add to the list box.

Returns: TListBox. The modified list box with the added tools.

This method allows you to add multiple tools to the list box in one call.


myListBox.Tools(tool1, tool2, tool3);

Static member TopIndex<TListBox>(listBox, topIndex)

Sets the TopIndex property of the specified ListBox.

ParameterTypeDescription
TListBoxThe type of the list box, must inherit from ListBox.
listBoxTListBoxThe list box for which to set the TopIndex property.
topIndexInt32The index of the first visible item in the list box.

Returns: TListBox. The modified list box with the updated TopIndex property.

This method allows you to specify the index of the first visible item in the list box.


myListBox.TopIndex(5);