diff --git a/MAUI/Badge-View/Badge-customization.md b/MAUI/Badge-View/Badge-customization.md index 14c267eb12..883795edb9 100644 --- a/MAUI/Badge-View/Badge-customization.md +++ b/MAUI/Badge-View/Badge-customization.md @@ -345,6 +345,140 @@ Content = sfBadgeView; ![Alignment](badge-customization_images/badge_alignment.png) +## Badge Alignment and Sizing + +The [BadgeAlignment](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.BadgeSettings.html#Syncfusion_Maui_Core_BadgeSettings_BadgeAlignment) property positions the badge text relative to the SfBadgeView's content. You can set this to Start, Center, or End. However, the final visual position of the badge is also dependent on how the SfBadgeView and its Content are sized. The following scenarios explain how alignment behaves based on different size configurations. + +### 1. Alignment with a Fixed Size on SfBadgeView + +When an explicit WidthRequest and HeightRequest are set directly on the SfBadgeView, the badge is aligned relative to these fixed dimensions. The size of the inner Content does not influence the badge's position. This approach is useful when you need the badge to appear at the edge of a specific, defined area, regardless of the content inside. + +{% tabs %} + +{% highlight xaml %} + + + + + + + + + + {% endhighlight %} + +{% highlight c# %} + +SfBadgeView sfBadgeView = new SfBadgeView(); +sfBadgeView.HorizontalOptions = LayoutOptions.Center; +sfBadgeView.VerticalOptions = LayoutOptions.Center; +sfBadgeView.WidthRequest = 100; +sfBadgeView.HeightRequest = 100; +sfBadgeView.BadgeText = "20"; +Label label = new Label(); +label.Text = "Start"; +label.BackgroundColor = Colors.LightGray; +label.HorizontalTextAlignment = TextAlignment.Center; +label.VerticalTextAlignment = TextAlignment.Center; +label.TextColor = Colors.Black; +sfBadgeView.Content = label; +BadgeSettings badgeSetting = new BadgeSettings(); +badgeSetting.BadgeAlignment = BadgeAlignment.Start; +sfBadgeView.BadgeSettings = badgeSetting; +Content = sfBadgeView; + +{% endhighlight %} + +{% endtabs %} + +![BadgeAlignment](badge-customization_images\WidthForBadgeView.png) + +### 2. Alignment with a Fixed Size on the Content + +When the SfBadgeView has no explicit size, but its Content does, the SfBadgeView wraps itself around the content. In this case, the badge is aligned relative to the bounds of the Content. This is a common scenario when you want to place a badge on a specific control like a Button or a larger Label. + +{% tabs %} + +{% highlight xaml %} + + + + + + + + + + {% endhighlight %} + +{% highlight c# %} + +SfBadgeView sfBadgeView = new SfBadgeView(); +sfBadgeView.BadgeText = "20"; +Label label = new Label(); +label.Text = "Start"; +label.BackgroundColor = Colors.LightGray; +label.HorizontalTextAlignment = TextAlignment.Center; +label.VerticalTextAlignment = TextAlignment.Center; +label.TextColor = Colors.Black; +label.WidthRequest = 100; +label.HeightRequest = 100; +sfBadgeView.Content = label; +BadgeSettings badgeSetting = new BadgeSettings(); +badgeSetting.BadgeAlignment = BadgeAlignment.Start; +sfBadgeView.BadgeSettings = badgeSetting; +Content = sfBadgeView; + +{% endhighlight %} + +{% endtabs %} + +![BadgeAlignment](badge-customization_images\WidthForContent.png) + +### 3. Alignment with Automatic Sizing + +When neither the SfBadgeView nor its Content has an explicit size, both controls size themselves automatically based on their content. The SfBadgeView wraps its Content, and the badge is then aligned relative to the final calculated bounds of that Content. + +{% tabs %} + +{% highlight xaml %} + + + + + + + + + + {% endhighlight %} + +{% highlight c# %} + +SfBadgeView sfBadgeView = new SfBadgeView(); +sfBadgeView.BadgeText = "20"; +Label label = new Label(); +label.Text = "Start"; +label.BackgroundColor = Colors.LightGray; +label.HorizontalTextAlignment = TextAlignment.Center; +label.VerticalTextAlignment = TextAlignment.Center; +label.TextColor = Colors.Black; +sfBadgeView.Content = label; +BadgeSettings badgeSetting = new BadgeSettings(); +badgeSetting.BadgeAlignment = BadgeAlignment.Start; +sfBadgeView.BadgeSettings = badgeSetting; +Content = sfBadgeView; + +{% endhighlight %} + +{% endtabs %} + +![BadgeAlignment](badge-customization_images\WithoutWidth.png) + + ## FontAutoScalingEnabled The [FontAutoScalingEnabled](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.BadgeSettings.html#Syncfusion_Maui_Core_BadgeSettings_FontAutoScalingEnabled) property automatically scales the badge text's font size based on the operating system's text size. The default value is `false`. diff --git a/MAUI/Badge-View/badge-customization_images/WidthForBadgeView.png b/MAUI/Badge-View/badge-customization_images/WidthForBadgeView.png new file mode 100644 index 0000000000..eef907b0e6 Binary files /dev/null and b/MAUI/Badge-View/badge-customization_images/WidthForBadgeView.png differ diff --git a/MAUI/Badge-View/badge-customization_images/WidthForContent.png b/MAUI/Badge-View/badge-customization_images/WidthForContent.png new file mode 100644 index 0000000000..ee04f2c678 Binary files /dev/null and b/MAUI/Badge-View/badge-customization_images/WidthForContent.png differ diff --git a/MAUI/Badge-View/badge-customization_images/WithoutWidth.png b/MAUI/Badge-View/badge-customization_images/WithoutWidth.png new file mode 100644 index 0000000000..310d45b1b3 Binary files /dev/null and b/MAUI/Badge-View/badge-customization_images/WithoutWidth.png differ diff --git a/MAUI/Chat/scrolling.md b/MAUI/Chat/scrolling.md index 3f62070243..632346c140 100644 --- a/MAUI/Chat/scrolling.md +++ b/MAUI/Chat/scrolling.md @@ -51,7 +51,7 @@ By default, the [SfChat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Cha ## Scroll to bottom button -The `SfChat` control provides the option to display a scroll to bottom button by setting the [ShowScrollToBottomButton](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html#Syncfusion_Maui_Chat_SfChat_ShowScrollToBottomButton) property to `true`. This button appears when scrolled up through older messages and allows quick navigation back to the latest message in the conversation. +The `SfChat` control provides the option to display a scroll to bottom button by setting the `ShowScrollToBottomButton` property to `true`. This button appears when scrolled up through older messages and allows quick navigation back to the latest message in the conversation. {% tabs %} {% highlight xaml hl_lines="4" %} @@ -76,7 +76,7 @@ sfChat.ShowScrollToBottomButton = true; ### Scroll to bottom button customization -The `SfChat` control allows you to fully customize the scroll to bottom button appearance by using the [ScrollToBottomButtonTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html#Syncfusion_Maui_Chat_SfChat_ScrollToBottomButtonTemplate) property. This property lets you define a custom view and style. +The `SfChat` control allows you to fully customize the scroll to bottom button appearance by using the `ScrollToBottomButtonTemplate` property. This property lets you define a custom view and style. {% tabs %} {% highlight xaml hl_lines="20" %}