How to apply style to the .NET MAUI Numeric Entry control?
This guide will walk you through the process of applying a custom style to the .NET MAUI Numeric Entry control, enhancing its appearance according to your design preferences.
Step 1: Define the Style in ResourceDictionary
In your XAML file, define a ContentPage.Resources
section. Inside this, create a Style with a unique key targeting the SfNumericEntry
control.
<ContentPage.Resources>
<Style x:Key="numericEntryStyle" TargetType="inputs:SfNumericEntry">
<Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
<Setter Property="VerticalOptions" Value="CenterAndExpand"/>
<Setter Property="TextColor" Value="Red"/>
<Setter Property="BackgroundColor" Value="Yellow"/>
<Setter Property="Value" Value="23"/>
</Style>
</ContentPage.Resources>
Step 2: Apply the Style to Numeric Entry
Within the ContentPage.Content
section, add the SfNumericEntry control. Apply the defined style using the Style
property, referencing the key to the style with the StaticResource
markup extension.
<ContentPage.Content>
<inputs:SfNumericEntry WidthRequest="200"
HeightRequest="50"
Style="{StaticResource numericEntryStyle}" />
</ContentPage.Content>
Output
Conclusion
I hope you enjoyed learning how to customize the appearance of Numeric Entry in .NET MAUI.
Refer to our .NET MAUI Numeric Entry feature tour page to learn about its other groundbreaking feature representations. You can explore our .NET MAUI Numeric Entry documentation to understand its features and how to use it.
Check out our .NET MAUI components from the License and Downloads page for current customers. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Numeric Entry and other .NET MAUI components.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!