Overview

BeepMapWidget is a paint-based WinForms widget that inherits from BaseControl. It uses an IWidgetPainter pipeline to render rich visuals without child controls. The Style property selects one of 10 built-in render modes; changing it at runtime immediately swaps the painter and triggers a repaint.

Toolbox icon: 🗺️
Category: Beep Widgets → Maps / Location
Default size: 320 × 220
Namespace: TheTechIdea.Beep.Winform.Controls.Widgets

Key Features

🗺️ Ten Location Styles

From a simple address card to a geographic heatmap — one widget.

📍 Static Map Preview

MapPreview renders a styled placeholder map background with a pin marker.

🌡️ Geographic Heatmap

GeographicHeatmap colours a grid by value intensity.

🛣️ Route Display

RouteDisplay renders an origin→destination path with waypoints.

📋 Location List

LocationList shows multiple locations with distance and direction badges.

🏨 Place Cards

PlaceCard renders venue name, category, and star rating.

Style Variants (10)

Style ValueDescription
LiveTrackingReal-time dot-on-map location tracker.
RouteDisplayStep-by-step route path visualisation.
LocationCardCard showing address, city, country with a pin icon.
GeographicHeatmapGrid/region heatmap coloured by data density.
AddressCardFormatted postal address with copy action.
MapPreviewSmall static map preview placeholder with marker.
LocationListScrollable list of locations with distance badges.
TravelCardOrigin-to-destination travel card with transport mode.
RegionMapSimplified regional/country map with data overlay.
PlaceCardPlace/venue card with name, photo, category, and rating.

Properties

PropertyTypeDefaultDescription
StyleMapWidgetStyleLocationCardSelects the map painter.
Titlestring"Map Widget"Card heading.
Subtitlestring"Location Data"Secondary heading.
Addressstring""Street address.
Citystring""City name.
Countrystring""Country name.
Latitudedouble0.0Decimal latitude for map styles.
Longitudedouble0.0Decimal longitude for map styles.
LocationsList<LocationItem>(empty)Multiple locations for list/route styles.
AccentColorColor(theme primary)Pin and accent colour.

Inherits all BaseControl properties (Border, Padding, Theme colors, etc.).

Events

EventArgs TypeDescription
LocationClickedBeepEventDataArgsFired when a map marker or location item is clicked. Data contains LocationItem.
CardClickedBeepEventDataArgsFired when the card body is clicked.
ActionClickedBeepEventDataArgsFired when an action button (e.g. 'Get Directions') is clicked.

Basic Usage

var location = new BeepMapWidget
{
    Style    = MapWidgetStyle.LocationCard,
    Title    = "Our Office",
    Address  = "123 Tech Avenue",
    City     = "San Francisco",
    Country  = "USA",
    Latitude  = 37.7749,
    Longitude = -122.4194,
    Size     = new Size(300, 160)
};

var route = new BeepMapWidget
{
    Style     = MapWidgetStyle.TravelCard,
    Title     = "Delivery Route",
    Locations = new List
    {
        new LocationItem { Name = "Warehouse",    City = "Oakland"       },
        new LocationItem { Name = "Distribution", City = "San Francisco" },
        new LocationItem { Name = "Customer",     City = "Palo Alto"     },
    },
    Size = new Size(340, 200)
};

Event Handling

location.ActionClicked += (s, e) => OpenMapsApp(location.Latitude, location.Longitude);
route.LocationClicked  += (s, e) =>
{
    var loc = (LocationItem)e.Data;
    ShowLocationDetail(loc.Name);
};

Best Practices

  • Set Style before adding the widget to the form to avoid double repaints.
  • Adjust Size to fit your layout — defaults are minimum comfortable sizes.
  • Read BeepEventDataArgs.Data in event handlers for context-specific click data.
  • Call Invalidate() after updating data properties to trigger a repaint.
  • Let theme colors flow from BeepStyling.CurrentTheme — avoid overriding color properties unless customization is explicitly desired.