728x90
반응형
728x170
▶ MonkeyModel.cs
namespace TestProject;
/// <summary>
/// 원숭이 모델
/// </summary>
public class MonkeyModel
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 이미지 URL - ImageURL
/// <summary>
/// 이미지 URL
/// </summary>
public string ImageURL { get; set; }
#endregion
#region 명칭 - Name
/// <summary>
/// 명칭
/// </summary>
public string Name { get; set; }
#endregion
#region 서식지 - Location
/// <summary>
/// 서식지
/// </summary>
public string Location { 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"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=netstandard"
xmlns:local="clr-namespace:TestProject">
<CollectionView Margin="10">
<CollectionView.ItemsSource>
<scg:List x:TypeArguments="local:MonkeyModel">
<local:MonkeyModel
ImageURL="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Papio_anubis_%28Serengeti%2C_2009%29.jpg/200px-Papio_anubis_%28Serengeti%2C_2009%29.jpg"
Name="Baboon"
Location="Africa and Asia" />
<local:MonkeyModel
ImageURL="https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Capuchin_Costa_Rica.jpg/200px-Capuchin_Costa_Rica.jpg"
Name="Capuchin Monkey"
Location="Central and South America" />
<local:MonkeyModel
ImageURL="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/BlueMonkey.jpg/220px-BlueMonkey.jpg"
Name="Blue Monkey"
Location="Central and East Africa" />
</scg:List>
</CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid
Padding="10"
RowDefinitions="Auto,Auto"
ColumnDefinitions="Auto,10,Auto">
<Image Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
WidthRequest="60"
HeightRequest="60"
Aspect="AspectFill"
Source="{Binding ImageURL}" />
<Label Grid.Column="2"
FontSize="16"
FontAttributes="Bold"
Text="{Binding Name}" />
<Label Grid.Row="1" Grid.Column="2"
VerticalOptions="End"
FontAttributes="Italic"
Text="{Binding Location}" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>
728x90
반응형
그리드형(광고전용)
'C# > MAUI' 카테고리의 다른 글
[C#/MAUI/.NET6] AutomationProperties 엘리먼트 : Name 첨부 속성 사용하기 (0) | 2022.06.15 |
---|---|
[C#/MAUI/.NET6] AutomationProperties 엘리먼트 : IsInAccessibleTree 첨부 속성 사용하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] AutomationProperties 엘리먼트 : ExcludedWithChildren 첨부 속성 사용하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] SemanticScreenReader 클래스 : Announce 정적 메소드 사용하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] x:TypeArguments 속성 : 제네릭 타입 인자로 복수 타입 사용하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] x:TypeArguments 속성 : 제네릭 타입 인자로 단일 기본 타입 사용하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] XamlCompilationAttribute 클래스 : 페이지 수준에서 XAML 컴파일 활성화하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] XamlCompilationAttribute 클래스 : 어셈블리 수준에서 XAML 컴파일 활성화하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] On 엘리먼트 : Platform 속성 사용하기 (0) | 2022.06.14 |
[C#/MAUI/.NET6] OnPlatform 엘리먼트 : Thickness 객체 설정하기 (0) | 2022.06.14 |
댓글을 달아 주세요