|
1 | 1 | --- |
2 | 2 | layout: post |
3 | | -title: Liquid Glass Support for .NET MAUI Combobox entry | Syncfusion® |
4 | | -description: Learn here about providing liquid glass support for Syncfusion® .NET MAUI Combobox (SfComboBox) control and more. |
| 3 | +title: Liquid Glass Effect for .NET MAUI Combo Box | Syncfusion® |
| 4 | +description: Learn how to enable and customize the Liquid Glass Effect in the Syncfusion® .NET MAUI Combo Box (SfComboBox) control. |
5 | 5 | platform: MAUI |
6 | 6 | control: SfComboBox |
7 | 7 | documentation: ug |
8 | 8 | --- |
9 | 9 |
|
10 | | -# Liquid Glass Support for .NET MAUI ComboBox |
| 10 | +# Liquid Glass Effect in .NET MAUI Combo Box (SfComboBox) |
11 | 11 |
|
12 | | -The [SfComboBox](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Inputs.SfComboBox.html) supports a `liquid glass` appearance by hosting the control inside the Syncfusion [SfGlassEffectView](). You can customize the effect using properties such as [EffectType](), [EnableShadowEffect](), and round the corners using [CornerRadius](). This approach improves visual depth and readability when SfComboBox is placed over images or colorful layouts. Additionally, the dropdown portion of SfComboBox applies the glass effect only when the [EnableLiquidGlassEffect]() property is set to true. |
| 12 | +The Liquid Glass Effect introduces a modern, translucent design with adaptive color tinting and light refraction, creating a sleek, glass like user experience that remains clear and accessible. This section explains how to enable and customize the effect in the Syncfusion® .NET MAUI Combo Box (SfComboBox) control. |
13 | 13 |
|
14 | | -## Availability |
| 14 | +## Apply liquid glass effect |
15 | 15 |
|
16 | | -1. This feature is supported on .NET 10 or greater. |
17 | | -2. This feature is supported on mac or iOS 26 or greater. |
18 | | -3. On platforms or versions below these requirements, the control renders without the acrylic blur effect and falls back to a standard background. |
| 16 | +Follow these steps to enable and configure the Liquid Glass Effect in the Combo Box control: |
19 | 17 |
|
20 | | -## Prerequisites |
| 18 | +### Step 1: Wrap the control inside glass effect view |
21 | 19 |
|
22 | | -- Add the Syncfusion.Maui.Core package (for SfGlassEffectView) and Syncfusion.Maui.Inputs (for SfComboBox). |
| 20 | +To apply the Liquid Glass Effect to Syncfusion® .NET MAUI `Combo Box` control, wrap the control inside the `SfGlassEffectView` class. |
23 | 21 |
|
24 | | -XAML example Wrap the SfComboBox in an SfGlassEffectView, then enable the dropdown’s glass effect with `EnableLiquidGlassEffect`. |
| 22 | +For more details, refer to the `Liquid Glass Getting Started documentation`. |
| 23 | + |
| 24 | +### Step 2: Enable the liquid glass effect on Combo Box |
| 25 | + |
| 26 | +Set the `EnableLiquidGlassEffect` property to `true` in the `SfComboBox` control to apply the Liquid Glass Effect. When enabled, the effect is also applied to its dependent controls and provides responsive interaction for a smooth and engaging user experience. |
| 27 | + |
| 28 | +### Step 3: Customize the background |
| 29 | + |
| 30 | +To achieve a glass like background in the Combo Box, set the `Background` and `DropDownBackground` property to `Transparent`. The background will then be treated as a tinted color, ensuring a consistent glass effect across the controls. |
| 31 | + |
| 32 | +The following code snippet demonstrates how to apply the Liquid Glass Effect to the `SfComboBox` control: |
25 | 33 |
|
26 | 34 | {% tabs %} |
27 | | -{% highlight xaml hl_lines="19 20 23" %} |
28 | | - |
29 | | -<?xml version="1.0" encoding="utf-8" ?> |
30 | | -<ContentPage |
31 | | - xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
32 | | - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
33 | | - xmlns:inputs="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs" |
34 | | - xmlns:core="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core" |
35 | | - x:Class="AcrylicComboboxBoxPage"> |
36 | | - |
37 | | - <Grid> |
38 | | - <!-- Background to make acrylic blur visible --> |
39 | | - <Image Source="wallpaper.jpg" Aspect="AspectFill" /> |
40 | | - <core:SfGlassEffectView |
41 | | - CornerRadius="20" |
42 | | - HeightRequest="40" |
43 | | - EffectType="Regular" |
44 | | - EnableShadowEffect="True"> |
45 | | - |
46 | | - <inputs:SfComboBox |
47 | | - EnableLiquidGlassEffect="True" |
48 | | - Background="Transparent" |
49 | | - ItemsSource="{Binding Employees}" |
50 | | - DisplayMemberPath="Name" |
51 | | - DropDownBackground="Transparent" |
52 | | - Placeholder="Select employee"/> |
53 | | - </core:SfGlassEffectView> |
54 | | - </Grid> |
55 | | -</ContentPage> |
| 35 | +{% highlight xaml tabtitle="MainPage.xaml" hl_lines="14 16 20" %} |
| 36 | + |
| 37 | +<Grid BackgroundColor="Transparent"> |
| 38 | + <core:SfGlassEffectView EffectType="Regular" |
| 39 | + CornerRadius="20"> |
| 40 | + <ComboBox:SfComboBox x:Name="ComboBox" |
| 41 | + Background="Transparent" |
| 42 | + DropDownBackground="Transparent" |
| 43 | + EnableLiquidGlassEffect="True"> |
| 44 | + </ComboBox:SfComboBox> |
| 45 | + </core:SfGlassEffectView> |
| 46 | +</Grid> |
56 | 47 |
|
57 | 48 | {% endhighlight %} |
58 | | -{% highlight c# hl_lines="14 17 18" %} |
| 49 | +{% highlight c# tabtitle="MainPage.xaml.cs" hl_lines="21 22 23 24 25 30" %} |
59 | 50 |
|
60 | 51 | using Syncfusion.Maui.Core; |
61 | 52 | using Syncfusion.Maui.Inputs; |
62 | 53 |
|
63 | | -var glassEffects = new SfGlassEffectView |
| 54 | +var grid = new Grid |
64 | 55 | { |
65 | | - CornerRadius=20, |
66 | | - HeightRequest=40, |
67 | | - EffectType=LiquidGlassEffectType.Regular, |
68 | | - EnableShadowEffect=True |
| 56 | + BackgroundColor = Colors.Transparent |
69 | 57 | }; |
70 | 58 |
|
71 | | -var Combobox = new SfComboBox |
| 59 | +var glassView = new SfGlassEffectView |
| 60 | +{ |
| 61 | + CornerRadius = 20, |
| 62 | + EffectType = LiquidGlassEffectType.Regular |
| 63 | +}; |
| 64 | + |
| 65 | +var comboBox = new SfComboBox |
72 | 66 | { |
73 | | - EnableLiquidGlassEffect = true, // Dropdown glass effect |
74 | | - ItemsSource = viewModel.Employees, |
75 | | - DisplayMemberPath = "Name", |
76 | 67 | Background = Colors.Transparent, |
77 | | - DropDownBackground= Colors.Transparent, |
78 | | - Placeholder = "Select employee", |
| 68 | + EnableLiquidGlassEffect = true, |
| 69 | + DropDownBackground = Colors.Transparent |
79 | 70 | }; |
80 | 71 |
|
81 | | -glassEffects.Content = Combobox; |
| 72 | +glassView.Content = this.comboBox; |
| 73 | +grid.Children.Add(glassView); |
| 74 | +this.Content = grid; |
82 | 75 |
|
83 | 76 | {% endhighlight %} |
84 | 77 | {% endtabs %} |
85 | 78 |
|
86 | | -The following screenshot illustrates SfComboBox within an acrylic container, with the dropdown using the glass effect. |
87 | | - |
88 | | - |
| 79 | +N> |
| 80 | +* Supported on `macOS 26 or higher` and `iOS 26 or higher`. |
| 81 | +* This feature is available only in `.NET 10.` |
0 commit comments