Class RDFormsListBox
A VB ListBox: a Avalonia.Controls.ListBox that shows a ListBox component.
public sealed class RDFormsListBox : ListBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlItemsControlSelectingItemsControlListBoxRDFormsListBox
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentINamedIInputElementIDataTemplateHostISetterValueIChildIndexProvider
- Inherited Members
-
ListBox.ScrollPropertyListBox.SelectedItemsPropertyListBox.SelectionPropertyListBox.SelectionModePropertyListBox.SelectAll()ListBox.UnselectAll()ListBox.ScrollListBox.SelectedItemsListBox.SelectionListBox.SelectionModeSelectingItemsControl.AutoScrollToSelectedItemPropertySelectingItemsControl.SelectedIndexPropertySelectingItemsControl.SelectedItemPropertySelectingItemsControl.SelectedValuePropertySelectingItemsControl.SelectedValueBindingPropertySelectingItemsControl.IsSelectedPropertySelectingItemsControl.IsTextSearchEnabledPropertySelectingItemsControl.IsSelectedChangedEventSelectingItemsControl.SelectionChangedEventSelectingItemsControl.WrapSelectionPropertySelectingItemsControl.BeginInit()SelectingItemsControl.EndInit()SelectingItemsControl.GetIsSelected(Control)SelectingItemsControl.ItemsControlFromItemContainer(Control)SelectingItemsControl.UpdateSelectionFromEvent(Control, RoutedEventArgs)SelectingItemsControl.AutoScrollToSelectedItemSelectingItemsControl.SelectedIndexSelectingItemsControl.SelectedItemSelectingItemsControl.SelectedValueBindingSelectingItemsControl.SelectedValueSelectingItemsControl.IsTextSearchEnabledSelectingItemsControl.WrapSelectionSelectingItemsControl.SelectionChangedItemsControl.ItemContainerThemePropertyItemsControl.ItemCountPropertyItemsControl.ItemsPanelPropertyItemsControl.ItemsSourcePropertyItemsControl.ItemTemplatePropertyItemsControl.DisplayMemberBindingPropertyItemsControl.IndexFromContainer(Control)ItemsControl.ItemFromContainer(Control)ItemsControl.GetRealizedContainers()ItemsControl.DisplayMemberBindingItemsControl.ItemContainerGeneratorItemsControl.ItemsItemsControl.ItemContainerThemeItemsControl.ItemCountItemsControl.ItemsPanelItemsControl.ItemsSourceItemsControl.ItemTemplateItemsControl.PresenterItemsControl.ItemsPanelRootItemsControl.ItemsViewItemsControl.PreparingContainerItemsControl.ContainerPreparedItemsControl.ContainerIndexChangedItemsControl.ContainerClearingTemplatedControl.BackgroundPropertyTemplatedControl.BackgroundSizingPropertyTemplatedControl.BorderBrushPropertyTemplatedControl.BorderThicknessPropertyTemplatedControl.CornerRadiusPropertyTemplatedControl.FontFamilyPropertyTemplatedControl.FontFeaturesPropertyTemplatedControl.FontSizePropertyTemplatedControl.FontStylePropertyTemplatedControl.FontWeightPropertyTemplatedControl.FontStretchPropertyTemplatedControl.ForegroundPropertyTemplatedControl.LetterSpacingPropertyTemplatedControl.PaddingPropertyTemplatedControl.TemplatePropertyTemplatedControl.IsTemplateFocusTargetPropertyTemplatedControl.TemplateAppliedEventTemplatedControl.GetIsTemplateFocusTarget(Control)TemplatedControl.ApplyTemplate()TemplatedControl.BackgroundTemplatedControl.BackgroundSizingTemplatedControl.BorderBrushTemplatedControl.BorderThicknessTemplatedControl.CornerRadiusTemplatedControl.FontFamilyTemplatedControl.FontFeaturesTemplatedControl.FontSizeTemplatedControl.FontStyleTemplatedControl.FontWeightTemplatedControl.FontStretchTemplatedControl.ForegroundTemplatedControl.LetterSpacingTemplatedControl.PaddingTemplatedControl.TemplateTemplatedControl.TemplateAppliedControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.GettingFocusEventInputElement.LostFocusEventInputElement.LosingFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.ContextRequestedEventInputElement.ContextCanceledEventInputElement.IsHoldingEnabledPropertyInputElement.IsHoldWithMouseEnabledPropertyInputElement.PinchEventInputElement.PinchEndedEventInputElement.PullGestureEventInputElement.PullGestureEndedEventInputElement.SwipeGestureEventInputElement.SwipeGestureEndedEventInputElement.ScrollGestureEventInputElement.ScrollGestureInertiaStartingEventInputElement.ScrollGestureEndedEventInputElement.PointerTouchPadGestureMagnifyEventInputElement.PointerTouchPadGestureRotateEventInputElement.PointerTouchPadGestureSwipeEventInputElement.TappedEventInputElement.RightTappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.GetIsHoldingEnabled(StyledElement)InputElement.GetIsHoldWithMouseEnabled(StyledElement)InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.GestureRecognizersInputElement.GotFocusInputElement.GettingFocusInputElement.LostFocusInputElement.LosingFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.ContextRequestedInputElement.ContextCanceledInputElement.PinchInputElement.PinchEndedInputElement.PullGestureInputElement.PullGestureEndedInputElement.ScrollGestureInputElement.ScrollGestureInertiaStartingInputElement.ScrollGestureEndedInputElement.PointerTouchPadGestureMagnifyInputElement.PointerTouchPadGestureRotateInputElement.SwipeGestureInputElement.SwipeGestureEndedInputElement.PointerTouchPadGestureSwipeInputElement.TappedInputElement.RightTappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.CacheModePropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.Render(DrawingContext)Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.CacheModeVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.ApplyStyling()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.Bind(AvaloniaProperty, BindingBase)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.DispatcherAvaloniaObject.PropertyChanged
Remarks
Its items are the component's List. AddItem(string, int?), RemoveItem(int) and Clear() change it, keep
its ItemData and ItemIcon in step, and keep the selection on the items that stay. An added item's data is 0.
An item's icon, its ItemIcon, is drawn before its text, scaled to fit a square as tall as the text. Where any item has one,
every item's text starts after that square, so that the text lines up. A metafile icon is not drawn. Item icons are an RD-VBA
addition.
Its Click comes from two places, as measured with VB6. A left press on an item raises Click at its release, before MouseUp, whether or not the selection changed and wherever the release lands; the press selects at once, and the selection follows the pointer over the items while the button is held. A left press below the items, and any right or middle press, selects nothing and raises no Click. A key or code that moves the selection raises Click, with ListIndex already the new value; setting it again, a key that can go no further, and a change to the items raise none.
With a MultiSelect of Simple or Extended, ListIndex is the item with the focus, 0 from the start, and the
selection is a set of items apart from it. Simple toggles the item pressed, whatever the modifiers; its arrow keys move only the
focus, and Space toggles. Extended selects the item pressed alone, toggles it with Ctrl, and with Shift selects from the anchor,
the last item pressed or reached without Shift. A drag moves the focus, and on an Extended list selects from the anchor too.
Every key such a list takes raises Click, whether or not anything changed.
It raises DblClick, GotFocus, LostFocus, KeyDown, KeyPress, KeyUp, MouseDown, MouseMove and MouseUp. A key's Click comes after its
KeyDown, and its KeyPress where it types a character, and before its KeyUp. Where its MultiSelect is None, a character
typed selects the next item that starts with it, after the selected one and from the top again past the last, compared without
regard to case, and raises Click where the selection moved.
Its rows are a line of its font high, inside a border of 2 pixels on each side. Where IntegralHeight is True, its height is
snapped to whole rows, at least one, as measured with VB6.
Constructors
RDFormsListBox(ComponentInstance)
Creates a list that shows a ListBox.
public RDFormsListBox(ComponentInstance instance)
Parameters
instanceComponentInstanceThe ListBox.
Remarks
It follows its MultiSelect set later, from code, as a list made with the new value: it keeps its items, and the item at
ListIndex stays selected where it was. To None, no other item stays selected; to Simple or Extended from None,
the selected item takes the focus, the first item where none is selected.
Exceptions
- ArgumentNullException
instanceis null.- ArgumentException
instanceis not a ListBox.
Properties
ListCount
The number of items.
public int ListCount { get; }
Property Value
ListIndex
The selected item, or on a multi-select list the focused one; -1 for none.
public int ListIndex { get; set; }
Property Value
Remarks
Setting it raises Click when it moves the selection, and none when it is set again. On a multi-select list it moves the focus, and selects and clears nothing.
Exceptions
- FormErrorException
Set outside -1 to ListCount - 1: 380, Invalid property value.
NewIndex
The index of the item the last AddItem(string, int?) added; -1 where none was added, and after a RemoveItem(int), a
Clear() or a new List of the component.
public int NewIndex { get; }
Property Value
SelCount
The number of items selected.
public int SelCount { get; }
Property Value
StyleKeyOverride
Gets the type by which the element is styled.
protected override Type StyleKeyOverride { get; }
Property Value
Remarks
Usually controls are styled by their own type, but there are instances where you want an element to be styled by its base type, e.g. creating SpecialButton that derives from Button and adds extra functionality but is still styled as a regular Button. Override this property to change the style for a control class, returning the type that you wish the elements to be styled as.
Text
The text of the item at ListIndex, or "" where there is none.
public string Text { get; }
Property Value
Methods
AddItem(string, int?)
Adds an item.
public void AddItem(string item, int? index = null)
Parameters
Exceptions
- FormErrorException
indexis outside 0 to ListCount: 5, Invalid procedure call or argument.
Clear()
Removes every item.
public void Clear()
CreateContainerForItemOverride(object?, int, object?)
Creates or a container that can be used to display an item.
protected override Control CreateContainerForItemOverride(object? item, int index, object? recycleKey)
Parameters
Returns
- Control
GetItemData(int)
Gets an item's data, the Long value attached to it.
public int GetItemData(int index)
Parameters
indexintThe item's index, from 0.
Returns
- int
The item's data.
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
GetItemIcon(int)
Gets an item's icon, the picture drawn before its text. Item icons are an RD-VBA addition.
public byte[]? GetItemIcon(int index)
Parameters
indexintThe item's index, from 0.
Returns
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
GetList(int)
Gets an item's text, as code's List(Index) does.
public string GetList(int index)
Parameters
indexintThe item's index, from 0.
Returns
- string
The item's text, or "" for an index outside the items.
GetSelected(int)
Gets whether an item is selected.
public bool GetSelected(int index)
Parameters
indexintThe item's index, from 0.
Returns
- bool
Whether it is selected.
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
OnKeyDown(KeyEventArgs)
Handles directional navigation within the Avalonia.Controls.ItemsControl.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsThe key events.
OnTextInput(TextInputEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.TextInputEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnTextInput(TextInputEventArgs e)
Parameters
eTextInputEventArgsData about the event.
PrepareContainerForItemOverride(Control, object?, int)
Prepares the specified element to display the specified item.
protected override void PrepareContainerForItemOverride(Control container, object? item, int index)
Parameters
containerControlThe element that's used to display the specified item.
itemobjectThe item to display.
indexintThe index of the item to display.
RemoveItem(int)
Removes an item.
public void RemoveItem(int index)
Parameters
indexintThe item's index, from 0.
Exceptions
- FormErrorException
indexis outside the items: 5, Invalid procedure call or argument.
SetItemData(int, int)
Sets an item's data, the Long value attached to it.
public void SetItemData(int index, int value)
Parameters
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
SetItemIcon(int, byte[]?)
Sets an item's icon, the picture drawn before its text. Item icons are an RD-VBA addition.
public void SetItemIcon(int index, byte[]? picture)
Parameters
indexintThe item's index, from 0.
picturebyte[]The picture, as the bytes of its file; null or no bytes for none.
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.pictureis refused by Inspect(byte[]?, out PictureInfo): 481, Invalid picture.
SetList(int, string)
Sets an item's text, as code's List(Index) = text does. The item keeps its data, its icon and its selection, and the
list raises nothing.
public void SetList(int index, string text)
Parameters
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
SetSelected(int, bool)
Selects or clears an item, and raises Click when that changes something.
public void SetSelected(int index, bool selected)
Parameters
Remarks
On a single-select list it moves the selection. On a multi-select one, selecting an item adds it and moves the focus to it, and clearing it removes it and leaves the focus.
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
SetText(string)
Selects the first item whose whole text is text, without regard to case, or none, and raises Click even
when the selection does not move. On a multi-select list it raises Click and changes nothing.
public void SetText(string text)
Parameters
textstringThe text.