The Mtf.Maui.Controls library provides a set of reusable, customizable ContentView components for .NET MAUI applications. These components enhance user interface capabilities with features like labeled controls, hyperlinks, and numeric input.
A ContentView combining a CheckBox with a customizable label.
- Label (
string): The text displayed alongside the checkbox. - IsChecked (
bool): The checked state of the checkbox. Supports two-way binding.
- ToggleCommand: Toggles the
IsCheckedstate programmatically.
<controls:CheckBoxWithLabel
Label="Accept Terms and Conditions"
IsChecked="{Binding IsAccepted}" />A labeled Entry field with extensive customization options.
- Label (
string): The label displayed above or alongside the entry. - Placeholder (
string): Placeholder text for the entry. Defaults toLabelif not set. - Text (
string): The entry’s text. Supports two-way binding. - Keyboard (
Keyboard): The type of keyboard (e.g.,Keyboard.Numeric). - IsPassword (
bool): Indicates if the entry should mask text (e.g., for passwords). - IsReadOnly (
bool): Disables text input whentrue. - EntryTextColor (
Color): Color of the entry text. - EntryMinimumWidthRequest (
int): Minimum width of the entry. - EntryMinimumHeightRequest (
int): Minimum height of the entry.
- TextChanged: Triggered when the
Textvalue changes.
- CopyToClipboardCommand: Copies the entry’s text to the clipboard.
<controls:EntryWithLabel
Label="Username"
Placeholder="Enter your username"
Text="{Binding Username}"
IsPassword="False" />A clickable hyperlink styled with visual feedback.
- Url (
string): The URL to navigate to. - LinkLabel (
string): The text displayed for the hyperlink.
- Changes color on hover.
- Opens the URL in the system’s default browser.
<controls:Hyperlink
Url="https://example.com"
LinkLabel="Visit Example" />A customizable menu item with navigation support.
- ImageSource (
List<string>): Image sources for the menu icon. - LabelText (
string): Text displayed on the menu item. - PageType (
Type): The page to navigate to when clicked. - Parameter (
object): Parameter to pass during navigation. - AfterExecution (
ICommand): Command to execute after navigation.
- NavigateCommand: Navigates to the specified page.
<controls:MenuItemView
LabelText="Settings"
PageType="{x:Type pages:SettingsPage}" />You can set up the MenuItemView to download images from an online source.
ImageSettings.UseOfflineImages = false;
ImageSettings.ImagesUrl = "https://cdn.example.com/images/";
ImageSettings.NumberOfDaysToCacheImages = 30; // Cache for 30 daysA numeric input control with increment and decrement buttons.
- Label (
string): Label displayed next to the control. - Value (
double): Current value. Supports two-way binding. - Minimum (
double): Minimum allowed value. - Maximum (
double): Maximum allowed value. - Increment (
double): Step size for value changes.
- ValueChanged: Triggered when
Valuechanges.
- Pressing and holding increment or decrement buttons changes the value repeatedly.
<controls:NumericUpDownWithLabel
Label="Quantity"
Value="{Binding Quantity}"
Minimum="1"
Maximum="100"
Increment="1" />- CommunityToolkit.Mvvm: Used for commands and messaging.
- System.Maui: Base dependency for MAUI applications.
Add the Mtf.Maui.Controls library to your MAUI project via NuGet:
dotnet add package Mtf.Maui.ControlsThis library is provided under the MIT License. Feel free to use and modify it in your applications.