첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ Border 엘리먼트를 사용해 제목을 장식하는 방법을 보여준다.

TestProject.zip
0.15MB

▶ MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <ContentPage.Resources>
        <LinearGradientBrush x:Key="BorderBackgroundLinearGradientBrushKey"
            EndPoint="0,1">
            <GradientStop Offset="0.1" Color="DarkGreen"  />
            <GradientStop Offset="1.0" Color="LightGreen" />
        </LinearGradientBrush>
        <Shadow x:Key="BorderShadowKey"
            Offset="10,10"
            Radius="20"
            Opacity="1">
            <Shadow.Brush>
                <LinearGradientBrush>
                    <GradientStop Offset="0.1" Color="LightGray" />
                    <GradientStop Offset="1.0" Color="Gray"      />
                </LinearGradientBrush>
            </Shadow.Brush>
        </Shadow>
        <Shadow x:Key="LabelShadowKey"
            Offset="10,10"
            Radius="10"
            Opacity="1">
            <Shadow.Brush>
                <LinearGradientBrush>
                    <GradientStop Offset="0.1" Color="Black" />
                    <GradientStop Offset="1.0" Color="Gray"  />
                </LinearGradientBrush>
            </Shadow.Brush>
        </Shadow>
    </ContentPage.Resources>
    <StackLayout
        HorizontalOptions="Center"
        VerticalOptions="Center"
        Spacing="10">
        <Grid Margin="10">
            <Border
                StrokeThickness="0"
                Background="{StaticResource BorderBackgroundLinearGradientBrushKey}"
                Shadow="{StaticResource BorderShadowKey}">
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="0,50,0,50" />
                </Border.StrokeShape>
            </Border>
            <Label
                HorizontalOptions="Center"
                VerticalOptions="Center"
                Padding="10"
                Shadow="{StaticResource LabelShadowKey}"
                FontSize="30"
                FontAttributes="Bold"
                TextColor="White"
                Text="MAUI" />
        </Grid>
        <Grid Margin="10">
            <Border
                StrokeThickness="0"
                Background="{StaticResource BorderBackgroundLinearGradientBrushKey}"
                Shadow="{StaticResource BorderShadowKey}">
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="0,0,50,50" />
                </Border.StrokeShape>
            </Border>
            <Label
                HorizontalOptions="Center"
                VerticalOptions="Center"
                Padding="10"
                Shadow="{StaticResource LabelShadowKey}"
                FontSize="30"
                FontAttributes="Bold"
                TextColor="White"
                Text="MAUI" />
        </Grid>
        <Grid Margin="10">
            <Border
                StrokeThickness="0"
                Background="{StaticResource BorderBackgroundLinearGradientBrushKey}"
                Shadow="{StaticResource BorderShadowKey}">
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="50,50,50,50" />
                </Border.StrokeShape>
            </Border>
            <Label
                HorizontalOptions="Center"
                VerticalOptions="Center"
                Padding="10"
                Shadow="{StaticResource LabelShadowKey}"
                FontSize="30"
                FontAttributes="Bold"
                TextColor="White"
                Text="MAUI" />
        </Grid>
    </StackLayout>
</ContentPage>
728x90
그리드형(광고전용)
Posted by icodebroker
,