ProgressBarAnimationBehavior
ProgressBar 애니메이션 동작은 현재 진행률 값에서 시간 경과에 따른 제공된 값으로 애니메이션 효과를 시킵니다 ProgressBar
. 이 메서드는 진행률 값, uint
기간(밀리초) 및 Easing
열거형 값을 허용 Double
합니다.
Important
동작을 공유하고 스타일을 통해 여러 컨트롤에 적용할 수 있으므로 .NET MAUI 커뮤니티 도구 키트 동작은 동작을 설정 BindingContext
하지 않습니다. 자세한 내용은 .NET MAUI 동작을 참조 하세요.
구문
XAML
XAML 네임스페이스 포함
XAML에서 도구 키트를 사용하려면 페이지 또는 보기에 다음 xmlns
을 추가해야 합니다.
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
따라서 다음을 수행합니다.
<ContentPage
x:Class="CommunityToolkit.Maui.Sample.Pages.MyPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
</ContentPage>
다음과 같이 포함 xmlns
하도록 수정됩니다.
<ContentPage
x:Class="CommunityToolkit.Maui.Sample.Pages.MyPage"
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">
</ContentPage>
ProgressBarAnimationBehavior 사용
XAML ProgressBarAnimationBehavior
에서 다음과 같이 사용할 수 있습니다.
<ContentPage
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"
x:Class="MyLittleApp.MainPage"
x:Name="Page">
<Label Text="The ProgressBarAnimationBehavior is a behavior that animates a ProgressBar" />
<ProgressBar>
<ProgressBar.Behaviors>
<toolkit:ProgressBarAnimationBehavior
x:Name="ProgressBarAnimationBehavior"
Progress="{Binding Source={x:Reference Page}, Path=BindingContext.Progress}"
Length="250"/>
</ProgressBar.Behaviors>
</ProgressBar>
</ContentPage>
C#
ProgressBarAnimationBehavior
C#에서 다음과 같이 사용할 수 있습니다.
class ProgressBarAnimationBehaviorPage : ContentPage
{
public ProgressBarAnimationBehaviorPage()
{
var progressBar = new ProgressBar();
var behavior = new ProgressBarAnimationBehavior()
{
Progress = 0.75,
Length = 250
};
progressBar.Behaviors.Add(behavior);
Content = progressBar;
}
}
C# 태그
이 CommunityToolkit.Maui.Markup
패키지는 C#에서 이를 Behavior
사용하는 훨씬 더 간결한 방법을 제공합니다.
using CommunityToolkit.Maui.Markup;
class ProgressBarAnimationBehaviorPage : ContentPage
{
public ProgressBarAnimationBehaviorPage()
{
Content = new ProgressBar()
.Behaviors(new ProgressBarAnimationBehavior
{
Progress = 0.75,
Length = 250
});
}
}
속성
속성 | Type | 설명 |
---|---|---|
진행률 | 두 배 | 1이 100%인 백분율로 애니메이션 효과를 줄 새 진행률 값이므로 0.75는 75%입니다. |
길이 | uint | 기간(밀리초) |
완화 | 열거형 | enum 를 제어하여 Easing 애니메이션 속도를 향상하거나 느리게 하는 방법을 제어하는 전송 함수를 지정할 수 있습니다. 감속에 대한 자세한 내용은 여기를 참조하세요. |
예제
.NET MAUI 커뮤니티 도구 키트 샘플 애플리케이션에서 이 동작의 예를 찾을 수 있습니다.
API
.NET MAUI 커뮤니티 도구 키트 GitHub 리포지토리에서 오버에 대한 ProgressBarAnimationBehavior
소스 코드를 찾을 수 있습니다.
.NET MAUI Community Toolkit
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기