Skip to content

This repository contains a sample explaining how to Change the Color of the Entire Border in .NET MAUI ComboBox on Windows and Android Platform

Notifications You must be signed in to change notification settings

SyncfusionExamples/How-to-Change-the-Color-of-the-Entire-Border-in-.NET-MAUI-ComboBox-on-Windows-and-Android-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

How to Apply Full Rectangular Border to the .NET MAUI ComboBox?

This repository contains a sample explaining how to Change the Color of the Entire Border in .NET MAUI ComboBox on Windows and Android Platform

Customizing ComboBox Border

To customize the border color of the .NET MAUI ComboBox (SfComboBox) on Windows and Android platforms, you can create a full border effect by wrapping the ComboBox within a Border control and setting ShowBorder="False" on the ComboBox itself. This allows full control over the ComboBox border’s color, thickness, and shape. Here’s an example:

XAML

<ContentPage.Resources>
    <!-- Define a Style for the ComboBox Border -->
    <Style TargetType="Border" x:Key="ComboBoxBorderStyle">
        <Setter Property="Stroke" Value="Red"/>
        <Setter Property="StrokeThickness" Value="2"/>
        <Setter Property="StrokeShape" Value="RoundRectangle 5"/>
    </Style>
</ContentPage.Resources>

<StackLayout Padding="20">
    <!-- Wrap SfComboBox in a Border to customize its appearance -->
    <Border Style="{StaticResource ComboBoxBorderStyle}">
        <editors:SfComboBox  
                ShowBorder="False"
                Placeholder="Select Here">
            <editors:SfComboBox.ItemsSource>
                <x:Array Type="{x:Type x:String}">
                    <x:String>Uganda</x:String>
                    <x:String>Ukraine</x:String>
                    <x:String>United States</x:String>
                    <x:String>United Kingdom</x:String>
                    <x:String>Uzbekistan</x:String>
                </x:Array>
            </editors:SfComboBox.ItemsSource>
        </editors:SfComboBox>
    </Border>
</StackLayout>

Output:

ComboBoxBorder.png

About

This repository contains a sample explaining how to Change the Color of the Entire Border in .NET MAUI ComboBox on Windows and Android Platform

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages