WebMap for Blazor
  • WebMap Blazor
    • Modernization
      • Overview
      • Modernization Challenges
      • Our solution
      • What is Blazor?
      • How does Blazor Work?
      • Windows Forms in Blazor
      • Deployment
      • Interfacing with hardware devices
    • Research for Blazor
      • Handling Reference Parameters in Async Methods with Ref<T>
      • Alternatives to Async Properties in C#
      • Issue with using "MessageBox.Show" in Blazor
      • File Upload Functionality
      • Async/Await Feature for WebMap Blazor
    • Assessment Tool
    • Conversion Tool
      • Getting Started
      • Modals and Dialogs
      • Static Service Management
      • ImageListStreamer
      • Solution and Project Structure
        • Solution Generator
    • DCP: Desktop Compatibility Library
      • API Documentation
        • Blazor DCP: Gap.Blazor.Application Class Reference
      • Components Information
        • Button Component
        • Application Data Component
        • GroupBox Component
        • Label Component
        • CheckBox
        • CheckedListBox
        • ComboBox
        • DateTimePicker
        • Form
        • ListBox
        • ListView
          • WMListViewDetails
        • Mdi Container Component
        • MenuStrip
        • MessageBox
        • MonthCalendar
        • Panel
        • PictureBox
        • ProgressBar
        • RadioButton
        • StatusStrip
        • ToolStripStatusLabel
        • TabControl
        • TabPage
        • TextBox
        • ToolStrip
          • ToolStripButton
          • ToolStripLabel
          • ToolStripSeparator
        • ToolTip
    • Post Conversion
      • How To?
        • Create a new WebMap Window?
        • Create a new WebMap Component?
        • Create a native Blazor Window in a WebMap app?
        • Create a native Blazor Component in a WebMap Window?
        • Change the default WebMap visual layout?
    • WebMap: Angular vs Blazor
      • Footprint
      • Binaries size
      • Chatiness
      • Performance
      • Extensibility
      • Maintainability
      • Debugging
      • Project Structure
    • WebMap for Blazor Release Notes
      • Beta version
    • FAQ
    • Errors and Troubleshooting
    • License
Powered by GitBook
On this page
  • Description
  • Usage
  • Properties
  • Methods
  • Dynamic Rendering
  • Events
Export as PDF
  1. WebMap Blazor
  2. DCP: Desktop Compatibility Library
  3. Components Information

ListBox

Description

This component represents a list box in Blazor using the Gap.Blazor.ListBox model. It uses the Telerik ListBox component to display a list of selectable items, supporting both single and multiple selection modes, dynamic updates, and synchronization with the backend model.

Usage

@using Gap.Blazor
@using Gap.Blazor.Components
@using Telerik.Blazor.Components
@inherits WMControlComponentBase
@namespace Gap.Blazor.Components

<WMStyleBase model=@ListBoxModel></WMStyleBase>
<TelerikListBox @ref="@ListBoxRef"
    Data="@ListBoxModel.ListControlItems"
    SelectionMode="@GetSelectionMode()"
    SelectedItemsChanged="SelectedIndexChangeCallback"
    Height="@ListBoxModel.Height.ToString()"
    Width="@ListBoxModel.Width.ToString()"
    class="@ListBoxModel.GetStringClasses()">
    <ListBoxToolBarSettings>
        <ListBoxToolBar Visible="true" />
    </ListBoxToolBarSettings>
</TelerikListBox>

Properties

  • ListBoxModel: Instance of the Gap.Blazor.ListBox model.

  • ListBoxRef: Reference to the Telerik ListBox component.

  • ListBoxData: Internal list of items (not directly used in rendering).

  • ListBoxSelectionModeValue: Stores the current selection mode.

Methods

  • OnInitialized(): Subscribes to model events such as item changes, selection changes, and mode changes.

  • SyncModelChanges(): Updates the UI based on model changes and rebinds the list box.

  • GetSelectionMode(): Maps the model’s SelectionMode to Telerik’s ListBoxSelectionMode:

    • SelectionMode.One → Single

    • Otherwise → Multiple

  • SelectedIndexChange(IEnumerable): Updates the model’s selected indices based on user interaction.

Dynamic Rendering

The component dynamically renders a list box based on the ListBox model:

WMStyleBase: Applies styles based on the model.

TelerikListBox: Displays the list of items with optional toolbar.

SelectionMode: Supports both single and multiple selection.

Events

  • Items Collection Events: AfterAdd, AfterAddRange, AfterClear, AfterInsert, AfterRemoveAt

  • Selection Events: SelectedIndexChanged, SelectedIndicesChanged, SelectionModeChanged

  • NotifyModelChanged: General event to trigger UI updates.

PreviousFormNextListView

Last updated 2 days ago