Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
X

XF-Material-Library

> 数据库
Open source

A Xamarin Forms library for implementing Material Design

633 stars0 likes1 views
WebsiteGitHub

About

A Xamarin Forms library for implementing Material Design

XF.Material Library

A Xamarin.Forms library for Xamarin.Android and Xamarin.iOS to implement Google's Material Design.

Support

  • Feel free to open an issue. Make sure to use one of the templates!
  • Commercial support is available. Integration with your app or services, samples, feature request, etc. Email: [email protected]
  • Powered by: baseflow.com

Contents

  • Getting Started
  • Features
    • Material UI
      • App Bar Customization
      • Cards
      • Buttons
      • Text Fields
      • Selection Controls
      • Menus
      • Slider
      • Switch
      • Typography Label
      • Chips
      • Circular Progress Indicator
      • Tintable Image Icon
    • Material Dialogs
      • Alert Dialog
      • Simple Dialog
      • Confirmation Dialog
      • Input Dialog
      • Loading Dialog
      • Snackbar
      • Styling Dialogs
    • Material Resources
      • Color
      • Typography
      • Adding the Material Resources
      • Retrieving a Material Resource
    • Changing the Status Bar Color
  • Android Compatibility Issues
  • Thanks and Appreciation

Getting Started

  1. Download the current version through NuGet and install it in your Xamarin.Forms projects.
  2. Call the Material.Init() method in each project:
…
  1. Configure your application's color and font resources. Read more about it here.

Additional configuration for iOS

In order to be able to change the status bar's colors using this or by setting your app colors here, add this to your info.plist file:

xml
UIViewControllerBasedStatusBarAppearance

Note: If some of the controls like progressbar, checkbox and radio buttons are not showing in iOS then add all the files from here to iOS project's Resources folder.

Features

Material UI

Under the XF.Material.Forms.UI namespace, the library offers a number of controls available.

App Bar Customization

You can customize the appearance of the App Bar by using the MaterialNavigationPage control.

Code Android iOS
``
Attached Properties

These are attached properties that can be used on pages that are navigated through the MaterialNavigationPage control.

  1. AppBarColor - The color of the app bar.

  2. AppBarTitleTextAlignment - The text alignment of the app bar title. The default value is TextAlignment.Start.

  3. AppBarTitleTextColor - The text color of the app bar title. The default value is Material.Color.OnPrimary.

  4. AppBarTitleFontFamily - The font family of the app bar title. The default value is Material.FontFamily.H6.

  5. AppBarTitleFontSize - The font size of the app bar title. The default value is 24.

  6. AppBarElevation - The size of the shadow below the app bar. The default value is 4.

  7. StatusBarColor - The color of the status bar.

Usage and Behavior

This control uses the new feature of Xamarin 3.3, the TitleView property, to be able to change the appearance of the app bar title. But when the TitleView property is set on a page, the attached properties will not work.

Cards

Cards contain content and actions about a single subject.

Code Android iOS
Property

MaterialCard inherits the Frame class.

  • Elevation - The virtual distance along the z-axis. The value determines the importance of the content pesented in this view. The default value is 1.

  • IsClickable - When set to true, the card displays a ripple-effect when touched.

  • ClickCommand - The command that will run when this card was touched and the property IsClickable is set to true.

  • ClickCommandParameter - The parameter to pass in ClickCommand when it is executed.

Event
  • Clicked - The event that is raised when this card was touched and the property IsClickable is set to true.
Usage

Cards are surfaces that display content and actions on a single topic. They should be easy to scan for relevant and actionable information. Elements, like text and images, should be placed on them in a way that clearly indicates hierarchy.

Read more about cards here.

Buttons

Buttons allow users to take actions, and make choices, with a single tap.

There are two types of buttons you can use: MaterialButton and MaterialIconButton

Code Android iOS
Properties

MaterialButton inherits the Button class. MaterialIconButton inherits the ContentView class.

Both of these controls have these common properties:

  1. ButtonType - The type of the button. The default value is Elevated.

    • Elevated - This button will cast a shadow.
    • Flat - This button will have no shadow.
    • Outlined - This button will have no shadow, has a transparent background, and has a border.
    • Text - This button will only show its label. It will not have a shadow, has a transparent background, and no border. Text buttons has a smaller inner padding as compared to the other button types.
  2. BackgroundColor - The color of the button's background. Outlined and Text button types will always have a transparent background color. Flat and elevated buttons have a default background color based on the value of MaterialColorConfiguration.Secondary.

  3. PressedBackgroundColor - The color of the button's background when it is pressed.

  4. DisabledBackgroundColor - The color of the button's background when it is disabled.

  5. Elevation - The virtual distance along the z-axis.

MaterialButton have these properties:

  1. Image - The icon to be displayed next to the button's label. The color of the icon will be based on the TextColor property value of the button.

  2. AllCaps - Whether the letters in the label of the button should be in upper case or not. By default, this is set to true.

MaterialIconButton has this property:

  1. Image - The image of the button.

  2. TintColor - The tint color of the image.

Usage & Behavior

Buttons communicate actions that users can take. They are typically placed throughout your UI.

  • Elevated and Flat

    These are high-emphasis buttons that are distinguished by their fill color and/or shadow. The actions bound to them are primary to your app.

  • Outlined

    These are medium-emphasis buttons. The actions bound to them are important, but are not the primary action in an app.

  • Text

    These buttons are typically used for less-pronounced actions, which are located in modal dialogs or in cards.

You can set the Elevation property of the button using XAML or C# code. You can also set values when the button is in normal state or pressed state.

Using XAML

xml

Using C#

csharp
// Button with a normal and pressed elevation of `4`
var button1 = new MaterialButton()
{
    Elevation = new MaterialElevation(4),
    Text = "Click"
};

// Button with a normal and pressed elevation of `4` using implicit operator
var button2 = new MaterialButton()
{
    Elevation = 4,
    Text = "Click"
};

// Button with a normal elevation of `4` and pressed elevation of `8`
var button3 = new MaterialButton()
{
    Elevation = new MaterialElevation(4,8),
    Text = "Click"
};

On press, buttons display touch feedback (ripple effect).

Read more about buttons here.

Text Fields

Text fields allow users to enter and edit text.

Code Android iOS
``
Properties

MaterialTextField inherits the ContentView class.

  1. AlwaysShowUnderline - Boolean flag determines whether the underline accent of this text field should always show or not. The default value is false.

  2. BackgroundColor - The background color of the text field. Default hex color value is #DCDCDC.

  3. ErrorColor - The color to indicate an error in the text field. The default value is based on the color value of MaterialColorConfiguration.Error.

  4. ErrorText - The text that will show to indicate an error in this text field. This will replace HelperText when HasError is set to true.

  5. ErrorIcon - The icon that will show to indicate an error in this text field. Will show when HasError is set to true.

  6. FocusCommand - The command that will be executed when this text field receives or loses focus.

  7. HasError - Boolean flag that indicates whether an error has occurred or not in this text field.

  8. HelperText - The text that appears below the text field to indicate additional hints for the text field.

  9. HelperTextColor - The color of the helper text. The default hex color value is #99000000.

  10. HelperTextFontFamily - The font family of the helper text. The ErrorText will use this as its font family.

  11. LeadingIcon - The image icon that will show on the left side of this text field.

  12. LeadingIconTintColor - The color to be used to tint the icon image of this text field. The default hex color value is #99000000.

  13. InputType - The keyboard input type to be used for this text field.

  14. MaxLength - The maximum allowed number of characters in this text field.

  15. Placeholder - The placeholder text of this text field. This property must never be null or empty.

  16. PlaceholderColor - The color of the placeholder text. The default hex color value is #99000000.

  17. ReturnType - The appearance of the return button of the keyboard.

  18. ReturnCommand - The command that will run when the user returns the input.

  19. ReturnCommandParameter - The parameter to be passed in ReturnCommand property when it is executed.

  20. Text - The input text of this text field.

  21. TextChangeCommand - The command that executes when there is a change in this text field's input text.

  22. TextColor - The color of the input text. The default hex color value is #D0000000.

  23. TextFontFamily - The font family of the input text. By default, it uses the MaterialFontConfiguration.Body2 font family.

  24. TintColor - The tint color of the underline accent and the placeholder of this text field when focused. The default color is set to the value of MaterialColorConfiguration.SecondaryColor.

  25. FloatingPlaceholderEnabled - Determines whether the placeholder should float above when the text field is focused.

  26. Choices - When the InputType property is set to MaterialInputType.Choice, provides the list of choices from which the user will select one.

  27. ChoicesBindingName - The name of the property of the items in the Choices property to display.

  28. ChoiceSelectedCommand - The command that will execute when an item is selected using the input type Choice. The parameter that will be passed to this command is the selected item.

  29. HorizontalPadding - The value that determines the left and r

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#baseflowmaterialmaterial-dialogsxamarin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库