Class SfBadgeView
The .NET MAUI Badge View control allows you to show a notification badge with a text over any controls. Adding a control in a Badge View control, you can show a notification badge value over the control.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Core
Assembly: Syncfusion.Maui.Core.dll
Syntax
public class SfBadgeView : SfContentView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IParentThemeElement, IThemeElement
Examples
The following examples show how to initialize the badge view.
<badge:SfBadgeView HorizontalOptions="Center"
VerticalOptions="Center"
BadgeText="20">
<badge:SfBadgeView.Content>
<Button Text="Primary"
WidthRequest="120"
HeightRequest="60"/>
</badge:SfBadgeView.Content>
</badge:SfBadgeView>
Constructors
SfBadgeView()
Initializes a new instance of the SfBadgeView class.
Declaration
public SfBadgeView()
Fields
BadgeSettingsProperty
Identifies the BadgeSettings bindable property.
Declaration
public static readonly BindableProperty BadgeSettingsProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for BadgeSettings bindable property. |
BadgeTextProperty
Identifies the BadgeText bindable property.
Declaration
public static readonly BindableProperty BadgeTextProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for BadgeText bindable property. |
ContentProperty
Identifies the content bindable property.
Declaration
public static readonly BindableProperty ContentProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for content bindable property. |
ScreenReaderTextProperty
Identifies the ScreenReaderText bindable property.
Declaration
public static readonly BindableProperty ScreenReaderTextProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for ScreenReaderText bindable property. |
Properties
BadgeSettings
Gets or sets the value for badge settings.
Declaration
public BadgeSettings BadgeSettings { get; set; }
Property Value
Type | Description |
---|---|
BadgeSettings | Specifies the badge settings of the badge. The default value is null. |
Examples
The following example shows how to apply the badge settings for a badge.
<badge:SfBadgeView BadgeText="20">
<badge:SfBadgeView.Content>
<Button Text="Primary"
WidthRequest="120"
HeightRequest="60"/>
</badge:SfBadgeView.Content>
<badge:SfBadgeView.BadgeSettings>
<badge:BadgeSettings Stroke="Orange"
StrokeThickness="2"/>
</badge:SfBadgeView.BadgeSettings>
</badge:SfBadgeView>
BadgeText
Gets or sets the text for the badge. The property will be set only if BadgeIcon is set to BadgeIcon.None.
Declaration
public string BadgeText { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies the badge text of the badge. The default value is an empty string. |
Examples
The following example shows how to apply the badge text for a badge.
<badge:SfBadgeView BadgeText="20">
<badge:SfBadgeView.Content>
<Button Text="Primary"
WidthRequest="120"
HeightRequest="60"/>
</badge:SfBadgeView.Content>
</badge:SfBadgeView>
ScreenReaderText
Gets or sets the screen reader text for the badge.
Declaration
public string ScreenReaderText { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies the screen reader text of the badge. The default value is an empty string. |
Examples
The following example shows how to apply the screen reader text for a badge.
<badge:SfBadgeView ScreenReaderText="20">
<badge:SfBadgeView.Content>
<Button Text="Primary"
WidthRequest="120"
HeightRequest="60"/>
</badge:SfBadgeView.Content>
</badge:SfBadgeView>
Methods
ArrangeContent(Rect)
ArrangeContent method.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Rect | bounds | The bounds. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | It returns the size. |
Overrides
Finalize()
Disconnect constructor
Declaration
protected override void Finalize()
OnBindingContextChanged()
Called when the binding context is changed.
Declaration
protected override void OnBindingContextChanged()
Overrides
OnDraw(ICanvas, RectF)
Draw method.
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | The Canvas. |
Microsoft.Maui.Graphics.RectF | dirtyRect | The rectangle. |
Overrides
OnPropertyChanged(String)
OnPropertyChanged method
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Property Name |