Microsoft Community Toolkits Documentation

repository·main·Indexed 41 days ago

https://github.com/microsoftdocs/communitytoolkit

Official guidance for .NET Foundation community toolkits, including .NET, .NET MAUI, and Windows Community Toolkits. Features documentation for CommunityToolkit.Diagnostics, including the Guard and ThrowHelper classes for efficient argument validation, and CommunityToolkit.HighPerformance, providing high-performance abstractions like Memory2D<T>, Span2D<T>, MemoryOwner<T>, and StringPool.

Tokens
250.8K
Snippets
785
Records
1K
Agent score
49%

What's inside Microsoft Community Toolkits

  1. Overview of the MVVM Toolkit

    main

    The CommunityToolkit.Mvvm package is a modern, fast, and modular library designed for implementing the Model-View-ViewModel (MVVM) pattern. It is platform and runtime independent, targeting .NET Standard 2.0, .NET Standard 2.1, and .NET 6.

    Key characteristics:

    • UI Framework Agnostic: Works with WinUI 3, UWP, WinForms, WPF, Xamarin, Uno, and more.
    • Modular (À la carte): All types are loosely-coupled, allowing you to use only the specific components you need without forcing a specific application structure.
    • Optimized: Includes a .NET 6 target for internal optimizations while maintaining an identical public API surface to the .NET Standard targets.
  2. Overview of Sizer controls

    main

    The Sizer controls are a set of UI components designed to allow users to resize different parts of a user interface in a consistent manner. The toolkit provides three primary controls:

    • GridSplitter: Used for splitting and resizing grid areas.
    • ContentSizer: Used for managing the resizing of content areas.
    • PropertySizer: Used for managing the resizing of property areas.

    These controls enable interactive layout manipulation within your application's UI.

  3. Overview of the .NET Community Toolkit

    main
    The .NET Community Toolkit is a collection of platform-agnostic helpers and APIs designed for all .NET developers. It is maintained by Microsoft as part of the .NET Foundation and is available via NuGet packages for both new and existing projects. Because it is built on .NET Standard, it can be used across various UI frameworks and by library authors.
  4. Overview of .NET MAUI Community Toolkit - Markup

    main
    C# Markup is a set of fluent helper methods and classes designed to build declarative .NET Multi-platform App UI (.NET MAUI) user interfaces directly in C# code. It provides a fluent API within the CommunityToolkit.Maui.Markup namespace, allowing for a clean separation between UI (View) and Business Logic (ViewModel) similar to XAML. It supports all .NET MAUI platforms and is compatible with .NET Hot Reload.
  5. Overview of .NET MAUI Community Toolkit Essentials

    main
    The .NET MAUI Community Toolkit Essentials provides a single, unified cross-platform API for accessing unique operating system and platform APIs (Android, iOS, MacCatalyst, Windows, and Tizen) from shared C# code. This allows developers to implement platform-specific features without writing platform-specific code in the UI layer, regardless of how the user interface is constructed.
  6. Overview of the .NET MAUI Community Toolkit

    main
    The .NET MAUI Community Toolkit is a collection of reusable elements designed to simplify common developer tasks in .NET MAUI applications. It provides a variety of tools including animations, behaviors, converters, effects, and helpers for building applications targeting iOS, Android, macOS, and WinUI.
  7. Overview of .NET MAUI Community Toolkit Extensions

    main
    The .NET MAUI Community Toolkit provides a collection of extension methods designed to simplify common development tasks in .NET MAUI applications. These extensions extend existing types to provide high-level functionality for animations, color manipulation, keyboard interaction, and dependency injection registration.
  8. Use .NET MAUI Community Toolkit Views

    main

    The .NET MAUI Community Toolkit provides a collection of pre-built, reusable views to extend standard .NET MAUI controls. Available views include:

    • AvatarView: Displays a user's avatar image or initials.
    • CameraView: Connects to a camera, displays a preview, and takes photos.
    • DrawingView: Provides a surface for drawing lines via touch or mouse; results can be saved as images.
    • Expander: An expandable container for hosting content.
    • LazyView: Delays the initialization of a View.
    • Map (Windows): A cross-platform view for displaying and annotating maps (Windows implementation provided by the toolkit).
    • MediaElement: Plays multimedia such as audio and video.
    • Popup: Allows building and presenting custom UI overlays.
    • RatingView: A flexible, customizable ItemTemplate for rating mechanisms.
    • SemanticOrderView: Controls the order of VisualElements for screen readers to improve application accessibility.
  9. Use the RadialGauge control for data visualization

    main

    The RadialGauge control is used to display values within a specific range using a needle on a circular face. It is designed for high-engagement dashboards, such as clocks, industrial panels, automotive dashboards, and aircraft cockpits.

    Key features include:

    • Animated Transitions: The control automatically animates changes to the needle position, scale range, and color range when configuration states change.
    • High Configurability: Supports rich styling and interactivity to suit various visualization needs.
    <!-- See RadialGaugeSample.xaml for implementation details -->
  10. Use Snackbar and Toast alerts in .NET MAUI

    main

    The .NET MAUI Community Toolkit extends standard .NET MAUI alerts by providing two types of timed notifications: Snackbar and Toast. These are useful for notifying users about operation successes or failures without requiring manual dismissal.

    Available Alert Types

    • Snackbar: A fully customizable timed alert that appears at the bottom of the screen by default. It is dismissed after a configurable duration and can be anchored to any IView.
    • Toast: A timed alert that appears at the bottom of the screen by default and is dismissed after a configurable duration. It is typically used for simpler, less interactive notifications.
  11. Use Icon markup extensions to simplify XAML

    main

    The Community Toolkit provides a group of markup extensions designed to simplify the declaration of various icon types in XAML. Instead of using verbose nested XAML elements, you can use compact markup extension syntax.

    Important Compatibility Note: These extensions return objects from the Windows.UI.Xaml.* namespace. They are intended for use with UWP controls. They will not work with Microsoft.UI.Xaml.* (WinUI) controls because the returned types (e.g., Windows.UI.Xaml.Controls.FontIconSource) will not match the expected types for WinUI controls. For WinUI, you must use explicit XAML syntax.

  12. Use HeaderedContentControl to display content with a header

    main

    The HeaderedContentControl is a layout control that allows you to display content alongside a specified header.

    Key Features

    • Flexible Header: The Header property accepts any object.
    • Custom Styling: Use the HeaderTemplate property to define a custom visual representation for the header.
    • Alignment: Content within the control aligns to the top-left by default, maintaining consistency with the standard ContentControl behavior.

    Important Limitations

    To maintain parity with the standard ContentControl functionality, the following properties have no effect when set on a HeaderedContentControl:

    • Background
    • BorderBrush
    • BorderThickness