🔗 What Are Bindable Properties in .NET MAUI?

Ali RazaAli Raza
3 min read

✅ What Is a Bindable Property?

A bindable property is not just a property, it’s a construct that integrates with the MAUI/XAML binding engine. It allows:

  • Data binding between UI and view models.

  • Change notification, so the UI updates when the data changes.

  • Reusability of custom controls by exposing properties to other developers or views.

When to Use Them and Why They're Essential

In .NET MAUI, bindable properties are a special type of property designed to support data binding, styling, and property change notifications. While many built-in controls like Button, Entry, and Label already include bindable properties (like Text, Color, or Command), when you're creating custom UI controls like a custom-styled entry or reusable button you'll need to define your own bindable properties to make those controls work seamlessly in XAML and MVVM.

🧰 Why Do We Use Bindable Properties?

You must use bindable properties when:

  • You're creating your own controls (like a custom button or entry) and want to expose properties such as Text, Command, or Placeholder to the outside world.

  • The base control doesn’t already expose a bindable property you need (e.g., if you're building a new control from scratch or wrapping an existing native view).

  • You want your property to support XAML data binding, styles, animations, and change tracking.

  • You're working in an MVVM architecture, where separation between UI and logic is key.

👇 Example: Creating a Bindable Text Property in a Custom Entry

Let’s say we’re creating a custom entry control (Customentry) and want to make its Text bindable.

public static readonly BindableProperty TextProperty = BindableProperty.Create(
    propertyName: nameof(Text),
    returnType: typeof(string),
    declaringType: typeof(OrangeEntry),
    defaultValue: null,
    defaultBindingMode: BindingMode.TwoWay);

public string Text
{
    get => (string)GetValue(TextProperty);
    set => SetValue(TextProperty, value);
}

BindableProperty.Create(...) sets up the property with binding support.

The Text property wraps the bindable backing field using GetValue() and SetValue().

💡 Why This Is Important

Framework-provided controls (like Entry, Label, Button) already define bindable properties internally. But when building your own control, like a custom-styled entry or reusable component, you must define your own bindable properties to expose those values to the UI and support binding.

Without defining bindable properties:

  • You can't bind values to or from XAML (e.g., Text="{Binding ...}" won’t work).

  • You lose support for MVVM, styles, and design-time data.

  • The control becomes hard to reuse and tightly coupled to specific logic.

🧪 XAML Usage of Bindable Property in Custom Control

Here’s how you’d bind the Text property in XAML:

<Border Style="{StaticResource CustomBorder}">
<Entry x:Name="txtEntry"
       Grid.Column="1"
       ios:Entry.CursorColor="White"
       Style="{StaticResource WhiteLargeEntryStyle}"
       TextChanged="OnEntryTextChanged"
       IsSpellCheckEnabled="True"
       IsTextPredictionEnabled="True"
       ClearButtonVisibility="WhileEditing"
       ReturnType="Done"
       Text="{Binding Source={x:Reference this}, Path=Text}"
       Placeholder="{Binding Source={x:Reference this}, Path=Placeholder}" />
</Border>

The key here is:

  • Text="{Binding ...}" works only because Text is a bindable property.

  • Without defining it via BindableProperty.Create(...), this binding would silently fail or do nothing.

🏁 Summary

FeatureBindable Property Benefit
MVVM SupportEnables seamless data binding
ReusabilityMakes your custom controls flexible and reusable
UI UpdatesAutomatically reflects data changes
XAML IntegrationFully bindable and styleable in XAML
Required in Custom ControlsWithout them, you can’t expose properties to views

✨ Final Thoughts

If you're creating your own UI controls in .NET MAUI and want them to support binding you need bindable properties. They’re not just a convenience they are essential to building scalable, maintainable, and reusable components.

By mastering bindable properties, you unlock the full power of the MAUI UI framework and clean MVVM architecture.

0
Subscribe to my newsletter

Read articles from Ali Raza directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ali Raza
Ali Raza

🚀 Tech Lead | .NET MAUI Expert | Mobile App Developer I'm Ali Raza, a passionate Tech Lead with over 6 years of experience in mobile app development. I specialize in .NET MAUI/Xamarin and have led multiple high-impact projects, including enterprise apps, fintech solutions, and eSIM technology. 🔹 What I Do: ✔ .NET MAUI & Xamarin – Building cross-platform apps with robust architectures ✔ eSIM & Fintech Apps – Leading innovations in digital connectivity & finance ✔ Performance Optimization – Creating high-quality, scalable mobile solutions ✔ Mentorship & Community Sharing – Helping developers master .NET MAUI 📢 Sharing Weekly Insights on .NET MAUI/Xamarin to help developers level up! Follow me for deep dives into Native Interop, API Optimization, and Advanced UI/UX techniques. Let’s connect and build something amazing! 🚀