[C#/MAUI/.NET6] DrawingView 엘리먼트 : IsMultiLineModeEnabled/ShouldClearOnFinish 속성을 사용해 2개 이상의 선 그리기
C#/MAUI 2022. 7. 31. 20:30728x90
반응형
728x170
▶ LineCollection.cs
using System.Collections.ObjectModel;
using CommunityToolkit.Maui.Core;
namespace TestProject;
/// <summary>
/// 라인 컬렉션
/// </summary>
public class LineCollection : ObservableCollection<IDrawingLine>
{
}
300x250
▶ 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:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:local="clr-namespace:TestProject">
<ContentPage.Resources>
<local:LineCollection x:Key="LineCollectionKey" />
</ContentPage.Resources>
<toolkit:DrawingView
Margin="10"
Background="Beige"
IsMultiLineModeEnabled="true"
ShouldClearOnFinish="false"
LineWidth="5"
LineColor="Blue"
Lines="{StaticResource LineCollectionKey}" />
</ContentPage>
728x90
▶ MauiProgram.cs
using CommunityToolkit.Maui;
namespace TestProject;
/// <summary>
/// MAUI 프로그램
/// </summary>
public static class MauiProgram
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Static
//////////////////////////////////////////////////////////////////////////////// Public
#region MAUI 앱 생성하기 - CreateMauiApp()
/// <summary>
/// MAUI 앱 생성하기
/// </summary>
/// <returns>MAUI 앱</returns>
public static MauiApp CreateMauiApp()
{
MauiAppBuilder builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts
(
fontCollection =>
{
fontCollection.AddFont("OpenSans-Regular.ttf" , "OpenSansRegular" );
fontCollection.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
}
);
return builder.Build();
}
#endregion
}
728x90
반응형
그리드형(광고전용)
'C# > MAUI' 카테고리의 다른 글
[C#/MAUI/.NET6] Popup 엘리먼트 : 팝업 표시하기 (0) | 2022.08.01 |
---|---|
[C#/MAUI/.NET6] DrawingView 클래스 : DrawingLine 객체를 생성해 선 추가하기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] DrawingView 클래스 : GetImageStream 메소드를 사용해 이미지 구하기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] DrawingView 클래스 : DrawingLineCompleted 이벤트를 사용해 선 그리기 완료시 처리하기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] DrawingView 클래스 : IsMultiLineModeEnabled/ShouldClearOnFinish 속성을 사용해 2개 이상의 선 그리기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] DrawingView 클래스 : LineWidth/LineColor/Lines 속성 사용하기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] DrawingView 엘리먼트 : LineWidth/LineColor/Lines 속성 사용하기 (0) | 2022.07.31 |
[C#/MAUI/.NET6] UniformItemsLayout 엘리먼트 : MaxColumns 속성을 사용해 최대 컬럼 수 설정하기 (0) | 2022.07.30 |
[C#/MAUI/.NET6] UniformItemsLayout 클래스 사용하기 (0) | 2022.07.30 |
[C#/MAUI/.NET6] UniformItemsLayout 엘리먼트 사용하기 (0) | 2022.07.30 |
댓글을 달아 주세요