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
  • Styles
  • Events
Export as PDF
  1. WebMap Blazor
  2. DCP: Desktop Compatibility Library
  3. Components Information

MonthCalendar

Description

This component represents a calendar control in Blazor using the Gap.Blazor.MonthCalendar model. It uses the Telerik Calendar component to support single or range date selection, with customizable appearance, date constraints, and interactive behaviors such as focus handling and cell rendering.

Usage

@if (this.Visible)
{
    <WMStyleBase model="@this.MonthCalendar"></WMStyleBase>

    <div class="@(this.MonthCalendar.GetStringClasses() + this.GetShowTodayStyle() + this.GetShowTodayCircleStyle())"
         tabindex="-1"
         @ref="this.CalendarWrapperRef">
        <TelerikCalendar AllowReverse="true"
                         Date="@this.CurrentDate"
                         Max="@this.MonthCalendar.MaxDate"
                         Min="@this.MonthCalendar.MinDate"
                         OnCellRender="@this.OnCellRenderHandler"
                         RangeEnd="@this.RangeEnd"
                         RangeEndChanged="@this.RangeEndChangeHandler"
                         RangeStart="@this.RangeStart"
                         RangeStartChanged="@this.RangeStartChangeHandler"
                         SelectionMode="@this.GetSelectionMode()"
                         ShowWeekNumbers="@this.MonthCalendar.ShowWeekNumbers"
                         Size="@ThemeConstants.Calendar.Size.Small"
                         View="CalendarView.Month"
                         @bind-Value="@this.SelectedDate"
                         @ref="this.CalendarRef">
        </TelerikCalendar>
    </div>
}

Properties

  • MonthCalendar: Instance of the Gap.Blazor.MonthCalendar model.

  • SelectedDate: Bound to SelectionStart in single selection mode.

  • RangeStart / RangeEnd: Used in range selection mode.

  • CurrentDate: Controls the visible month in the calendar.

  • CalendarRef: Reference to the Telerik Calendar component.

  • CalendarWrapperRef: Reference to the calendar container for JS interop.

Methods

  • OnInitialized(): Subscribes to model events and initializes selection.

  • OnAfterRenderAsync(): Registers JS focus handler on first render.

  • GetSelectionMode(): Returns Single or Range based on MaxSelectionCount.

  • OnCellRenderHandler(): Adds CSS classes to cells outside min/max range or exceeding selection bounds.

  • RangeStartChangeHandler() / RangeEndChangeHandler(): Updates selection range and triggers events.

  • SetSelectionRange(start, end): Applies selection logic with max range enforcement.

  • SyncModelSelectionChanges(): Updates selection and triggers UI refresh.

  • UpdateSelection(): Refreshes calendar view and updates internal state.

  • OnDateChanged() / OnDateSelected(): Triggers model events for date changes.

Dynamic Rendering

  • TelerikCalendar: Renders the calendar UI with support for:

    • Single or range selection

    • Min/Max date constraints

    • Week numbers

    • Custom cell rendering

  • CSS Classes: Dynamically applied to hide today button or circle.

Styles

.hide-today-button { /* hides today button */ }
.hide-today-circle { /* hides today circle */ }
.hide-date { visibility: hidden; }
.exceeds-max-range { opacity: 0.5; pointer-events: none; }

Events

  • MaxDateChanged / MinDateChanged / DateChanged

  • MaxSelectionCountChanged / ShowWeekNumbersChanged

  • ShowTodayChanged / ShowTodayCircleChanged

  • OnDateChanged / OnDateSelected

PreviousMessageBoxNextPanel

Last updated 2 days ago