-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathDragDropExtensions.cs
36 lines (31 loc) · 1.1 KB
/
DragDropExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#if WINDOWS || MACCATALYST
namespace MauiPaint;
using Microsoft.Maui.Platform;
public static class DragDropExtensions
{
public static void RegisterDrag(this IElement element, IMauiContext? mauiContext, Func<CancellationToken, Task<Stream>> content)
{
ArgumentNullException.ThrowIfNull(mauiContext);
var view = element.ToPlatform(mauiContext);
DragDropHelper.RegisterDrag(view, content);
}
public static void UnRegisterDrag(this IElement element, IMauiContext? mauiContext)
{
ArgumentNullException.ThrowIfNull(mauiContext);
var view = element.ToPlatform(mauiContext);
DragDropHelper.UnRegisterDrag(view);
}
public static void RegisterDrop(this IElement element, IMauiContext? mauiContext, Func<Stream, Task>? content)
{
ArgumentNullException.ThrowIfNull(mauiContext);
var view = element.ToPlatform(mauiContext);
DragDropHelper.RegisterDrop(view, content);
}
public static void UnRegisterDrop(this IElement element, IMauiContext? mauiContext)
{
ArgumentNullException.ThrowIfNull(mauiContext);
var view = element.ToPlatform(mauiContext);
DragDropHelper.UnRegisterDrop(view);
}
}
#endif