зеркало из https://github.com/DeGsoft/maui-linux.git
Implement Progress proprerty in WinUI ProgressBarHandler
This commit is contained in:
Родитель
fc90bf6c40
Коммит
ab7d07ac9d
|
@ -1,13 +1,14 @@
|
|||
using System;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Maui.Handlers
|
||||
{
|
||||
public partial class ProgressBarHandler : ViewHandler<IProgress, ProgressBar>
|
||||
{
|
||||
protected override ProgressBar CreateNativeView() => new ProgressBar();
|
||||
protected override ProgressBar CreateNativeView() => new ProgressBar { Minimum = 0, Maximum = 1 };
|
||||
|
||||
[MissingMapper]
|
||||
public static void MapProgress(ProgressBarHandler handler, IProgress progress) { }
|
||||
public static void MapProgress(ProgressBarHandler handler, IProgress progress)
|
||||
{
|
||||
handler.NativeView?.UpdateProgress(progress);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Maui
|
||||
{
|
||||
public static class ProgressBarExtensions
|
||||
{
|
||||
public static void UpdateProgress(this ProgressBar nativeProgressBar, IProgress progress)
|
||||
{
|
||||
nativeProgressBar.Value = progress.Progress;
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче