Skip to content

Commit 310563a

Browse files
committed
997111-Added .cs code snippet in getting started page
1 parent 9174f00 commit 310563a

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

MAUI/Liquid-Glass-UI/getting-started.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,122 @@ xmlns:button="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.But
100100
</core:SfGlassEffectView>
101101
</Grid>
102102

103+
{% endhighlight %}
104+
{% highlight C# hl_lines="22" %}
105+
106+
using Syncfusion.Maui.Core;
107+
using Syncfusion.Maui.Buttons;
108+
109+
// Gradient background
110+
var gradientBrush = new LinearGradientBrush
111+
{
112+
StartPoint = new Point(0, 0),
113+
EndPoint = new Point(0, 1),
114+
GradientStops = new GradientStopCollection
115+
{
116+
new GradientStop { Color = Color.FromArgb("#0F4C75"), Offset = 0.0f },
117+
new GradientStop { Color = Color.FromArgb("#3282B8"), Offset = 0.5f },
118+
new GradientStop { Color = Color.FromArgb("#1B262C"), Offset = 1.0f }
119+
}
120+
};
121+
122+
// Avatar inside glass effect
123+
var avatarGlass = new SfGlassEffectView
124+
{
125+
WidthRequest = 64,
126+
HeightRequest = 64,
127+
EffectType = GlassEffectType.Clear,
128+
CornerRadius = 32,
129+
Content = new SfAvatarView
130+
{
131+
WidthRequest = 64,
132+
HeightRequest = 64,
133+
FontSize = 24,
134+
CornerRadius = 32,
135+
FontAttributes = FontAttributes.Bold,
136+
AvatarName = "SF",
137+
Background = Colors.Transparent,
138+
ContentType = AvatarContentType.Initials,
139+
InitialsType = InitialsType.DoubleCharacter
140+
}
141+
};
142+
143+
// Title and subtitle
144+
var textStack = new VerticalStackLayout
145+
{
146+
Spacing = 2,
147+
VerticalOptions = LayoutOptions.Center,
148+
Children =
149+
{
150+
new Label
151+
{
152+
Text = "Syncfusion®",
153+
TextColor = Colors.White,
154+
FontAttributes = FontAttributes.Bold,
155+
FontSize = 20
156+
},
157+
new Label
158+
{
159+
Text = "Deliver innovation with ease",
160+
TextColor = Color.FromArgb("#DDFFFFFF"),
161+
FontSize = 15
162+
}
163+
}
164+
};
165+
166+
// Action button inside glass effect
167+
var buttonGlass = new SfGlassEffectView
168+
{
169+
CornerRadius = 20,
170+
EffectType = GlassEffectType.Clear,
171+
WidthRequest = 100,
172+
HeightRequest = 40,
173+
Content = new SfButton
174+
{
175+
Text = "Follow",
176+
Background = Colors.Transparent,
177+
TextColor = Colors.White
178+
}
179+
};
180+
181+
// Inner grid layout
182+
var innerGrid = new Grid
183+
{
184+
ColumnDefinitions = new ColumnDefinitionCollection
185+
{
186+
new ColumnDefinition { Width = 64 },
187+
new ColumnDefinition { Width = GridLength.Star },
188+
new ColumnDefinition { Width = GridLength.Auto }
189+
},
190+
ColumnSpacing = 12,
191+
Children =
192+
{
193+
avatarGlass,
194+
{ textStack, 1, 0 },
195+
{ buttonGlass, 2, 0 }
196+
}
197+
};
198+
199+
// Outer glass effect container
200+
var outerGlass = new SfGlassEffectView
201+
{
202+
CornerRadius = 20,
203+
EffectType = GlassEffectType.Clear,
204+
Padding = 16,
205+
HeightRequest = 140,
206+
WidthRequest = 420,
207+
Content = innerGrid
208+
};
209+
210+
// Root grid with gradient background
211+
var rootGrid = new Grid
212+
{
213+
Background = gradientBrush,
214+
Children = { outerGlass }
215+
};
216+
217+
Content = rootGrid;
218+
103219
{% endhighlight %}
104220
{% endtabs %}
105221

0 commit comments

Comments
 (0)