|
1 | 1 | --- |
2 | 2 | layout: post |
3 | | -title: Appearance Customization of .NET MAUI Segmented Control (SfSegmentedControl) | Syncfusion<sup>®</sup> |
4 | | -description: Learn about the appearance customization of Syncfusion<sup>®</sup> .NET MAUI Segmented Control (SfSegmentedControl). |
| 3 | +title: Appearance Customization of .NET MAUI SfSegmentedControl | Syncfusion® |
| 4 | +description: Learn about the appearance customization of Syncfusion® .NET MAUI Segmented Control (SfSegmentedControl). |
5 | 5 | platform: maui |
6 | 6 | control: Segmented (SfSegmented) control |
7 | 7 | documentation: ug |
8 | 8 | --- |
9 | 9 |
|
10 | | -# Appearance Customization of .NET MAUI Segmented Control (SfSegmentedControl) |
| 10 | +# Appearance Customization of .NET MAUI SfSegmentedControl |
11 | 11 | The .NET MAUI Segmented control allows you to customize the background, text color, selection style, and more. |
12 | 12 |
|
13 | 13 | ## Customize the border color |
@@ -245,7 +245,7 @@ public partial class MainPage : ContentPage |
245 | 245 | Customize the text style of each segment item using the [TextStyle](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentItem.html#Syncfusion_Maui_Buttons_SfSegmentItem_TextStyle) property of [SfSegmentItem](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentItem.html). |
246 | 246 |
|
247 | 247 | {% tabs %} |
248 | | -{% highlight C# tabtitle="MainPage.xaml.cs"%} |
| 248 | +{% highlight C# tabtitle="MainPage.xaml.cs" %} |
249 | 249 |
|
250 | 250 | using Syncfusion.Maui.Buttons; |
251 | 251 | . . . |
@@ -324,7 +324,7 @@ public partial class MainPage : ContentPage |
324 | 324 | Customize the background of each segment item using the [Background](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentItem.html#Syncfusion_Maui_Buttons_SfSegmentItem_Background) property of [SfSegmentItem](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentItem.html). |
325 | 325 |
|
326 | 326 | {% tabs %} |
327 | | -{% highlight C# tabtitle="MainPage.xaml.cs"%} |
| 327 | +{% highlight C# tabtitle="MainPage.xaml.cs" %} |
328 | 328 |
|
329 | 329 | using Syncfusion.Maui.Buttons; |
330 | 330 | . . . |
@@ -352,6 +352,56 @@ public partial class MainPage : ContentPage |
352 | 352 |
|
353 | 353 |  |
354 | 354 |
|
| 355 | +## Separator Visibility Change to Show or Hide Separator |
| 356 | + |
| 357 | +The [ShowSeparator](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentedControl.html#Syncfusion_Maui_Buttons_SfSegmentedControl_ShowSeparator) property is used to control the visibility of the separator line that appears between the segments in the [SfSegmentedControl](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentedControl.html?tabs=tabid-34%2Ctabid-30%2Ctabid-19%2Ctabid-16%2Ctabid-37%2Ctabid-3%2Ctabid-24%2Ctabid-32%2Ctabid-8%2Ctabid-36%2Ctabid-10%2Ctabid-6%2Ctabid-14%2Ctabid-26%2Ctabid-28%2Ctabid-22%2Ctabid-12%2Ctabid-1). By default, the separator is visible, and setting this property to false hides the separator line. |
| 358 | + |
| 359 | +{% tabs %} |
| 360 | +{% highlight XAML hl_lines="2" %} |
| 361 | + |
| 362 | +<ContentPage xmlns:buttons="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.Buttons"> |
| 363 | + <buttons:SfSegmentedControl x:Name="segmentedControl" ShowSeparator="False"> |
| 364 | + <buttons:SfSegmentedControl.ItemsSource> |
| 365 | + <x:Array Type="{x:Type x:String}"> |
| 366 | + <x:String>Day</x:String> |
| 367 | + <x:String>Week</x:String> |
| 368 | + <x:String>Month</x:String> |
| 369 | + <x:String>Year</x:String> |
| 370 | + </x:Array> |
| 371 | + </buttons:SfSegmentedControl.ItemsSource> |
| 372 | + </buttons:SfSegmentedControl> |
| 373 | +</ContentPage> |
| 374 | + |
| 375 | +{% endhighlight %} |
| 376 | +{% highlight C# hl_lines="18" %} |
| 377 | + |
| 378 | +using Syncfusion.Maui.Buttons; |
| 379 | +. . . |
| 380 | + |
| 381 | +public partial class MainPage : ContentPage |
| 382 | +{ |
| 383 | + public MainPage() |
| 384 | + { |
| 385 | + InitializeComponent(); |
| 386 | + SfSegmentedControl segmentedControl = new SfSegmentedControl(); |
| 387 | + List<SfSegmentItem> itemList = new List<SfSegmentItem> |
| 388 | + { |
| 389 | + new SfSegmentItem() {Text = "Day"}, |
| 390 | + new SfSegmentItem() {Text = "Week"}, |
| 391 | + new SfSegmentItem() {Text = "Month"}, |
| 392 | + new SfSegmentItem() {Text = "Year"}, |
| 393 | + }; |
| 394 | + segmentedControl.ItemsSource = itemList; |
| 395 | + segmentedControl.ShowSeparator = false; |
| 396 | + this.Content = segmentedControl; |
| 397 | + } |
| 398 | +} |
| 399 | + |
| 400 | +{% endhighlight %} |
| 401 | +{% endtabs %} |
| 402 | + |
| 403 | + |
| 404 | + |
355 | 405 | ## Customize segment items appearance using DataTemplate |
356 | 406 |
|
357 | 407 | Use the [SegmentTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentedControl.html#Syncfusion_Maui_Buttons_SfSegmentedControl_SegmentTemplate) property of [SfSegmentedControl](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSegmentedControl.html) to create custom segmented control. The following example code shows how to create a custom segmented control using a data template. |
|
0 commit comments