Class RDFormsFileListBox
A VB FileListBox: a Avalonia.Controls.ListBox that shows a FileListBox component, the files of a folder.
public sealed class RDFormsFileListBox : ListBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlItemsControlSelectingItemsControlListBoxRDFormsFileListBox
- 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 names of the files in Path that match the component's Pattern, as the names are on disk,
sorted without regard to case. A hidden file is listed only where Hidden is True, and a system file only where
System is True; Archive, Normal and ReadOnly leave the list as it is, as measured with VB6. The list
is read again when Path, Pattern, Hidden or System changes and on Refresh(); a file
made or removed on disk shows only then.
Pattern holds one or more patterns separated by semicolons, such as *.txt;*.bas, and a file that matches any of them
is listed. * stands for any characters and ? for one, without regard to case, and a pattern that ends with .*
also matches a name with no extension. A change of Pattern raises PatternChange.
With a MultiSelect of Simple or Extended, it selects files as a RDFormsListBox with that MultiSelect does:
ListIndex is the file with the focus, the first one each time the files are listed, and the selection is a set of
files apart from it. FileName is the file with the focus, selected or not.
It raises Click, DblClick, GotFocus, LostFocus, KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, MouseUp, PathChange and PatternChange. A press, a key or a typed character raises Click as a ListBox's does.
Constructors
RDFormsFileListBox(ComponentInstance, IFileSystem)
Creates a list that shows a FileListBox.
public RDFormsFileListBox(ComponentInstance instance, IFileSystem fileSystem)
Parameters
instanceComponentInstanceThe FileListBox.
fileSystemIFileSystemThe file system it lists the files of. Its current directory is the list's first Path.
Remarks
It follows its MultiSelect set later, from code, as a RDFormsListBox does, keeping its files.
Exceptions
- ArgumentNullException
instanceorfileSystemis null.- ArgumentException
instanceis not a FileListBox.
Properties
FileName
The selected file's name, or on a multi-select list the focused one's; "" where there is none.
public string FileName { get; set; }
Property Value
Remarks
Setting a file's name makes it the Pattern, which lists that file alone, and selects it, or on a multi-select list gives
it the focus; it reads back as the name is on disk. Setting a pattern, one with * or ?, makes it the
Pattern and selects nothing. A name or a pattern with a folder sets Path to that folder first.
It raises PathChange where the folder changes and PatternChange where the Pattern does, and no Click. A file's name
then raises DblClick; the same file again raises nothing. Where only the folder changes, the DblClick is RDForms' own.
Exceptions
- FormErrorException
Set to a file that does not exist: 53, File not found. Set in a folder that does not exist: 76, Path not found.
ListCount
The number of files listed.
public int ListCount { get; }
Property Value
ListIndex
The selected file, -1 for none; on a multi-select list, the focused file, 0 where there is 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, -1 raises Click and changes nothing, and the focused file does nothing.
Exceptions
- FormErrorException
Set outside -1 to ListCount - 1: 381, Invalid property array index. On a multi-select list, set to anything but -1 and the focused file: 381.
Path
The folder whose files are listed, without a separator at its end.
public string Path { get; set; }
Property Value
Remarks
A relative path is taken from the list's own Path. Setting a new folder lists its files, leaves no file selected, and raises PathChange; setting the same one again raises nothing.
Exceptions
- FormErrorException
Set to a folder that does not exist: 76, Path not found.
Pattern
The component's Pattern: the patterns a file's name must match to be listed.
public string Pattern { get; set; }
Property Value
Remarks
Setting it lists the files again, and raises PatternChange where it changes.
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.
Methods
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
GetList(int)
Gets a file's name.
public string GetList(int index)
Parameters
indexintThe file's index, from 0.
Returns
- string
The file's name, or "" for an index outside the list.
GetSelected(int)
Gets whether a file is selected.
public bool GetSelected(int index)
Parameters
indexintThe file's index, from 0.
Returns
- bool
Whether it is selected.
Exceptions
- FormErrorException
indexis outside the files: 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.
Refresh()
Reads the files of Path again, and leaves no file selected.
public void Refresh()
SetSelected(int, bool)
Selects or clears a file, 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, and clearing the selected file leaves none. On a multi-select one, selecting a file adds it and moves the focus to it, and clearing it removes it and leaves the focus.
Exceptions
- FormErrorException
indexis outside the files: 381, Invalid property array index.