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

TestProject.zip
0.26MB

▶ PhotoModel.cs

namespace TestProject;

/// <summary>
/// 사진 모델
/// </summary>
public class PhotoModel
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Property
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region ID - ID

    /// <summary>
    /// ID
    /// </summary>
    public string ID { get; set; }

    #endregion
    #region 제목 - Title

    /// <summary>
    /// 제목
    /// </summary>
    public string Title { get; set; }

    #endregion
    #region 이미지 소스 - ImageSource

    /// <summary>
    /// 이미지 소스
    /// </summary>
    public ImageSource ImageSource { get; set; }

    #endregion
}

 

728x90

 

▶ 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">
    <Grid
        Margin="10"
        RowDefinitions="*,2*,*">
        <CarouselView Grid.Row="1"
            BackgroundColor="Cornsilk">
            <CarouselView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Frame
                            HorizontalOptions="Center"
                            HeightRequest="300"
                            CornerRadius="5"
                            BorderColor="DarkGray"
                            HasShadow="True">
                            <StackLayout Spacing="10">
                                <Label
                                    HorizontalOptions="Center"
                                    FontSize="16"
                                    Text="{Binding ID}" />
                                <Label
                                    HorizontalOptions="Center"
                                    FontSize="18"
                                    FontAttributes="Bold"
                                    Text="{Binding Title}" />
                                <Image
                                    HorizontalOptions="Center"
                                    WidthRequest="200"
                                    HeightRequest="200"
                                    Aspect="Fill"
                                    Source="{Binding ImageSource}" />
                            </StackLayout>
                        </Frame>
                    </Grid>
                </DataTemplate>
            </CarouselView.ItemTemplate>
            <CarouselView.EmptyView>
                <ContentView>
                    <Grid>
                        <Frame
                            HorizontalOptions="Center"
                            HeightRequest="300"
                            CornerRadius="5"
                            BorderColor="DarkGray"
                            HasShadow="True">
                            <Label
                                HorizontalOptions="Center"
                                FontSize="16"
                                Text="표시할 항목이 없습니다." />
                        </Frame>
                    </Grid>
                </ContentView>
            </CarouselView.EmptyView>
        </CarouselView>
    </Grid>
</ContentPage>

 

300x250

 

▶ MainPage.xaml.cs

namespace TestProject;

/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : ContentPage
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - MainPage()

    /// <summary>
    /// 생성자
    /// </summary>
    public MainPage()
    {
        InitializeComponent();
    }

    #endregion
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요