Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

928065 [Hotfix] - Revamp the UG documentation of .NET MAUI SfButton. #2958

Open
wants to merge 3 commits into
base: hotfix/hotfix-v28.1.33
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 51 additions & 40 deletions MAUI/Button/Customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: post
title: Customization in .NET MAUI Button control | Syncfusion
description: Learn here all about Customization support in Syncfusion .NET MAUI Button (SfButton) control and more.
platform: maui
control: Sfbutton
control: SfButton
documentation: ug
---

Expand All @@ -22,8 +22,8 @@ The [`TextColor`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.Butto
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" TextColor = "White">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" TextColor = "White">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -44,8 +44,8 @@ The [`FontSize`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.Button
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" FontSize = "18">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" FontSize = "18">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -66,8 +66,8 @@ The [`FontAttributes`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" FontAttributes = "Italic">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" FontAttributes = "Italic">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -88,8 +88,8 @@ The [`FontFamily`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.Butt
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" FontFamily = "Samantha-Demo">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" FontFamily = "Samantha-Demo">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -110,8 +110,8 @@ The [`HorizontalTextAlignment`](https://help.syncfusion.com/cr/maui/Syncfusion.M
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" HorizontalTextAlignment="Center" VerticalTextAlignment="Center">
</button:SfButton>
<buttons:SfButton x:Name="button" Text="Button" WidthRequest="200" HorizontalTextAlignment="Center" VerticalTextAlignment="Center">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -131,12 +131,13 @@ Users can now customize the [`SfButton`](https://help.syncfusion.com/cr/maui/Syn
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button"
<buttons:SfButton x:Name="button"
Text="Submit"
WidthRequest="200"
TextTransform="Uppercase"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center">
</button:SfButton>
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand Down Expand Up @@ -165,8 +166,8 @@ The [`LineBreakMode`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Button
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Add Items To Cart" LineBreakMode="MiddleTruncation" ImageSource="Cart.png">
</button:SfButton>
<buttons:SfButton x:Name="button" Text="Add Items To Cart" WidthRequest="200" LineBreakMode="MiddleTruncation" ImageSource="Cart.png">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -192,8 +193,8 @@ The [`Background`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.S
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" Background = "DeepSkyBlue">
</button:SfButton>
<buttons:SfButton x:Name="button" Text="Button" WidthRequest="200" Background = "DeepSkyBlue">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -216,8 +217,8 @@ The [`Stroke`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.ButtonBa
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" Stroke="Red">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" Stroke="Red" StrokeThickness="2">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -229,6 +230,8 @@ button.Stroke = Colors.Red;
{% endhighlight %}
{% endtabs %}

N> To display the `Stroke` color, we should define the `StrokeThickness` property.

![SfButton with stroke](images/customization-images/Button_border.png)

### StrokeThickness
Expand All @@ -238,8 +241,8 @@ The [`StrokeThickness`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" Stroke="Red" StrokeThickness="6">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" Stroke="Red" StrokeThickness="6">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -261,8 +264,8 @@ The [`CornerRadius`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.Bu
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" CornerRadius="20">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" CornerRadius="20">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -287,8 +290,8 @@ You can enable the Icon image using the [`ShowIcon`](https://help.syncfusion.com
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" ImageSource="Heart.png" ShowIcon="True">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" ImageSource="Heart.png" ShowIcon="True">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -310,8 +313,8 @@ N> Enable the [`ShowIcon`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.C
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" ImageSource="Heart.png" ShowIcon="True">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" ImageSource="Heart.png" ShowIcon="True">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand All @@ -335,8 +338,8 @@ N> Enable the `ShowIcon` property to enable the `ImageSize` property.
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" ImageSource="Heart.png" ShowIcon="True" ImageSize="50">
</button:SfButton>
<buttons:SfButton x:Name="button" WidthRequest="200" Text="Button" ImageSource="Heart.png" ShowIcon="True" ImageSize="50">
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand Down Expand Up @@ -372,6 +375,7 @@ N> Enable the `ShowIcon` property to enable the `ImageAlignment` property.
<buttons:SfButton x:Name="button"
Text="Shopping"
TextColor="Black"
WidthRequest="200"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
ShowIcon="True"
Expand Down Expand Up @@ -408,6 +412,7 @@ SfButton button = new SfButton()

<buttons:SfButton x:Name="button"
Text="Shopping"
WidthRequest="200"
TextColor="Black"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
Expand Down Expand Up @@ -446,6 +451,7 @@ SfButton button = new SfButton()

<buttons:SfButton x:Name="button"
Text="Shopping"
WidthRequest="200"
TextColor="Black"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
Expand Down Expand Up @@ -484,6 +490,7 @@ SfButton button = new SfButton()

<buttons:SfButton x:Name="button"
Text="Shopping"
WidthRequest="200"
TextColor="Black"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
Expand Down Expand Up @@ -523,6 +530,7 @@ SfButton button = new SfButton()
<buttons:SfButton x:Name="button"
Text="Shopping"
TextColor="Black"
WidthRequest="200"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
ShowIcon="True"
Expand Down Expand Up @@ -563,6 +571,7 @@ In RTL flow direction, image alignment with [`Start`](https://help.syncfusion.co
<buttons:SfButton x:Name="button"
Text="Shopping"
TextColor="Black"
WidthRequest="200"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
ShowIcon="True"
Expand Down Expand Up @@ -603,6 +612,7 @@ In RTL flow direction, image alignment with [`End`](https://help.syncfusion.com/
<buttons:SfButton x:Name="button"
Text="Shopping"
TextColor="Black"
WidthRequest="200"
HorizontalOptions="Center"
ImageSource="add_to_card.png"
ShowIcon="True"
Expand Down Expand Up @@ -640,7 +650,7 @@ The [EnableRippleEffect](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Cor
{% tabs %}
{% highlight xaml %}

<button:SfButton x:Name="button" Text="Button" EnableRippleEffect="True" />
<buttons:SfButton x:Name="button" Text="Button" EnableRippleEffect="True" />

{% endhighlight %}
{% highlight c# %}
Expand Down Expand Up @@ -668,27 +678,27 @@ Refer to this [`documentation`](https://learn.microsoft.com/en-us/dotnet/maui/us

. . .

<button:SfButton Text="Linear Gradient" CornerRadius="20">
<button:SfButton.Background>
<buttons:SfButton Text="Linear Gradient" CornerRadius="20" WidthRequest="200">
<buttons:SfButton.Background>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="#0D62D4" Offset="0"/>
<GradientStop Color="#9F3CDC" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</button:SfButton.Background>
</button:SfButton>
</buttons:SfButton.Background>
</buttons:SfButton>

<button:SfButton Text="Radial Gradient" CornerRadius="20">
<button:SfButton.Background>
<buttons:SfButton Text="Radial Gradient" CornerRadius="20">
<buttons:SfButton.Background>
<RadialGradientBrush Radius="1.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#0D62D4" Offset="0"/>
<GradientStop Color="#9F3CDC" Offset="1"/>
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</button:SfButton.Background>
</button:SfButton>
</buttons:SfButton.Background>
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand Down Expand Up @@ -735,11 +745,12 @@ N> Default value is [`null`].
<local:CommandDemoViewModel />
</ContentPage.BindingContext>

<button:SfButton x:Name="button"
<buttons:SfButton x:Name="button"
Text="Button"
WidthRequest="200"
Background="{Binding Background}"
Command="{Binding ButtonCommand}">
</button:SfButton>
</buttons:SfButton>

{% endhighlight %}
{% highlight c# %}
Expand Down
4 changes: 4 additions & 0 deletions MAUI/Button/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ N> Ensure that the images mentioned in the code snippets are located in the **Re
<buttons:SfButton x:Name="SfButton"
Text="Button"
TextColor="White"
WidthRequest="150"
HorizontalTextAlignment="Justify"
ShowIcon="True"
ImageSource="button_Heart.png"/>

Expand All @@ -139,6 +141,8 @@ N> Ensure that the images mentioned in the code snippets are located in the **Re
SfButton button = new SfButton();
button.Text = "Button";
button.TextColor = Colors.White;
button.WidthRequest = 150;
button.HorizontalTextAlignment = TextAlignment.Start,
button.ImageSource = "button_Heart.png";
button.ShowIcon = true;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/customization-images/Button_border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/customization-images/Button_cornerradius.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/customization-images/Button_fontsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/customization-images/Button_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/customization-images/Button_textColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/overview/Overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MAUI/Button/Images/right-to-left/RTL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions MAUI/Button/Visual-States.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ N> The visual states [Checked](https://help.syncfusion.com/cr/maui/Syncfusion.Ma
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Background" Value="Orange"/>
<Setter Property="Background" Value="#6A4C9C"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Checked">
Expand Down Expand Up @@ -83,7 +83,7 @@ N> The visual states [Checked](https://help.syncfusion.com/cr/maui/Syncfusion.Ma
{
Name = "Normal"
};
normalState.Setters.Add(new Setter { Property = SfButton.BackgroundProperty, Value = Colors.Orange });
normalState.Setters.Add(new Setter { Property = SfButton.BackgroundProperty, Value = Color.FromRgba("#6A4C9C") });

VisualState checkedState = new VisualState
{
Expand Down
Loading