Class RDFormsComboBox
A VB ComboBox: a Avalonia.Controls.ComboBox that shows a ComboBox component.
public sealed class RDFormsComboBox : ComboBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlItemsControlSelectingItemsControlComboBoxRDFormsComboBox
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentINamedIInputElementIDataTemplateHostISetterValueIChildIndexProvider
- Inherited Members
-
ComboBox.IsDropDownOpenPropertyComboBox.IsEditablePropertyComboBox.MaxDropDownHeightPropertyComboBox.SelectionBoxItemPropertyComboBox.PlaceholderTextPropertyComboBox.PlaceholderForegroundPropertyComboBox.HorizontalContentAlignmentPropertyComboBox.VerticalContentAlignmentPropertyComboBox.TextPropertyComboBox.SelectionBoxItemTemplatePropertyComboBox.IsDropDownOpenComboBox.IsEditableComboBox.MaxDropDownHeightComboBox.SelectionBoxItemComboBox.PlaceholderTextComboBox.PlaceholderForegroundComboBox.HorizontalContentAlignmentComboBox.VerticalContentAlignmentComboBox.SelectionBoxItemTemplateComboBox.DropDownClosedComboBox.DropDownOpenedSelectingItemsControl.AutoScrollToSelectedItemPropertySelectingItemsControl.SelectedIndexPropertySelectingItemsControl.SelectedItemPropertySelectingItemsControl.SelectedValuePropertySelectingItemsControl.SelectedValueBindingPropertySelectingItemsControl.IsSelectedPropertySelectingItemsControl.IsTextSearchEnabledPropertySelectingItemsControl.IsSelectedChangedEventSelectingItemsControl.SelectionChangedEventSelectingItemsControl.WrapSelectionPropertySelectingItemsControl.BeginInit()SelectingItemsControl.EndInit()SelectingItemsControl.GetIsSelected(Control)SelectingItemsControl.ItemsControlFromItemContainer(Control)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. At a Style of Dropdown Combo, the component's Text is the edit box's:
typing sets it, code's Text selects no item, and choosing an item puts its text in the box. At Dropdown List it has no
edit box, and Text is its selected item's.
Its events, as measured with VB6: Click is a choice, raised for every pick of an item by the mouse (the one already selected too),
every arrow key that moves the selection with the list open or closed, a Dropdown List's character that selects another item,
and code's ListIndex when it moves. Change is the edit box's, raised from the component's Text, from typing and from
code, never from choosing an item. DropDown is raised as the list opens. It raises GotFocus and LostFocus once as the combo is
entered and left, whether the combo or its edit box has the focus. KeyDown, KeyPress and KeyUp are raised for the keys of the combo,
of its edit box and of its open list, and the form raises none of its own for them where its KeyPreview is False. A key's
Click, Change or DropDown comes after its KeyDown, and its KeyPress where it types a character, and before its KeyUp.
AddItem(string, int?), RemoveItem(int) and Clear() keep the component's ItemData and ItemIcon
in step with its items. An added item's data is 0.
An item's icon, its ItemIcon, is drawn before its text in the list, 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 Dropdown List draws its selected item's icon
in its box too; a Dropdown Combo's edit box shows text only. A metafile icon is not drawn. Item icons are an RD-VBA addition.
Typing completes an item's text as RD-VBA's code completion completes a name (an RD-VBA addition): an item whose text starts with
what is typed matches first, then one whose humps it matches (MP matches MultiPlayer), without regard to case. A
Dropdown List adds up the characters typed into a word while an item matches it, and selects the best match; a character that no item matches with the
word starts a new one, which selects the next item it matches after the selected one. A Dropdown Combo's typing opens its list and
shows only the items its text matches, best first and highlighted: Up and Down move the highlight, and Enter chooses the
highlighted item, as a click on an item does. The text stays what was typed until an item is chosen, and the list closes where no
item matches.
A Simple Combo shows its edit box with its list always shown under it and no button; the list takes the rest of its height, and
scrolls where its items do not fit. Its rows are a line of its font high, and its edit box a row and 8 pixels: 13 and 21 at the
default font. Where IntegralHeight is True, its height is snapped to whole rows of its list, or to the edit box alone where
no row fits; a height from code of the edit box's or less is ignored. A press on the list picks the item under it, or the last
item when the press is below the items, even the item already selected; a pick raises Click and no Change, and leaves the focus in
the edit box. A press that moves the focus selects the item before the focus moves, and the text follows before the Click. A double
click is one Click, then DblClick. Its list never drops, and it raises no DropDown. Typing does not complete or filter.
A Locked combo keeps out the user, not code: its edit box takes no typing, its list does not drop, and neither the keys nor
the pointer pick an item. Its key events are raised. Code's Text and ListIndex still set it.
Constructors
RDFormsComboBox(ComponentInstance)
Creates a combo that shows a ComboBox.
public RDFormsComboBox(ComponentInstance instance)
Parameters
instanceComponentInstanceThe ComboBox.
Remarks
It follows its Style set later, from code, as a combo made with the new value: it keeps its items and its selection, and
its text where it has an edit box before and after. A Dropdown List's edit box, where it gains one, takes the selected item's
text, or "" with none. Changing the Style raises no event.
Exceptions
- ArgumentNullException
instanceis null.- ArgumentException
instanceis not a ComboBox.
Properties
ListCount
The number of items.
public int ListCount { get; }
Property Value
ListIndex
The selected item; -1 for none.
public int ListIndex { get; set; }
Property Value
Remarks
Setting it raises Click when it moves the selection, and none when it does not.
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
SelLength
The component's SelLength: the number of characters selected in the edit box, from SelStart.
public int SelLength { get; set; }
Property Value
Remarks
As a single-line TextBox's SelLength.
Exceptions
- FormErrorException
Set below 0 or above 65535, or read or set on a Dropdown List: 380, Invalid property value.
SelStart
The component's SelStart: where the edit box's selection starts, or its caret's place where nothing is selected; 0 is
before the first character.
public int SelStart { get; set; }
Property Value
Remarks
As a single-line TextBox's SelStart. A text from code, or an item chosen with ListIndex, leaves nothing
selected, the caret before the first character.
Exceptions
- FormErrorException
Set below 0 or above 65535, or read or set on a Dropdown List, which has no edit box: 380, Invalid property value.
SelText
The component's SelText: the text selected in the edit box; "" where nothing is selected.
public string SelText { get; set; }
Property Value
Remarks
As a single-line TextBox's SelText: setting it puts the text in place of the selection, the caret after it, and raises
Change once, even where the text does not change. Where an item is selected, it selects none, ListIndex -1.
Exceptions
- ArgumentNullException
Set to null.
- FormErrorException
Read or set on a Dropdown List: 380, Invalid 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 combo's text: a Dropdown List's selected item, or "" with none; the edit box's otherwise.
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, as VB's Clear does.
public void Clear()
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.
OnApplyTemplate(TemplateAppliedEventArgs)
Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameters
eTemplateAppliedEventArgsThe event args.
OnCreateAutomationPeer()
Returns a new, type-specific Avalonia.Automation.Peers.AutomationPeer implementation for the control.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer
The type-specific Avalonia.Automation.Peers.AutomationPeer implementation.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
changeAvaloniaPropertyChangedEventArgsThe property change details.
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 combo
raises nothing. Where the item is the selected one, the combo's Text is the new text: a Dropdown List's, and the edit box's,
as choosing the item puts its text there. Another item's leaves the edit box as it is.
public void SetList(int index, string text)
Parameters
Exceptions
- FormErrorException
indexis outside the items: 381, Invalid property array index.
SetText(string)
Sets the combo's text, as code's Text does.
public void SetText(string text)
Parameters
textstringThe text.
Remarks
On a Dropdown List it selects the first item whose whole text it is, without regard to case, and raises Click every time, even
where that item is selected already. Otherwise the component's Text takes it, the selection clears even where it is an
item's text, and Change is raised, once; nothing happens where it is the text already, compared exactly.
Exceptions
- FormErrorException
On a Dropdown List, no item's whole text is
text: 383, with VB's description "'Text' property is read-only".
UpdateSelectionFromEvent(Control, RoutedEventArgs)
Updates the selection based on an event that may have originated in a container that belongs to the control.
public override bool UpdateSelectionFromEvent(Control container, RoutedEventArgs eventArgs)
Parameters
containerControleventArgsRoutedEventArgs
Returns
- bool
True if the event was accepted and handled, otherwise false.
- See Also
-
ShouldTriggerSelection(Visual, PointerEventArgs)ShouldTriggerSelection(Visual, KeyEventArgs)