Skip to content

Commit

Permalink
feat(dragdrop): Implement UIElement.CanDrag and AllowDrop
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Oct 16, 2020
1 parent 2b52694 commit bbff5ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public bool IsDoubleTapEnabled
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool AllowDrop
{
Expand Down Expand Up @@ -228,7 +228,7 @@ public bool UseLayoutRounding
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool CanDrag
{
Expand Down Expand Up @@ -723,7 +723,7 @@ public bool CanBeScrollAnchor
typeof(global::Windows.UI.Xaml.UIElement),
new FrameworkPropertyMetadata(default(bool)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty AllowDropProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
Expand Down Expand Up @@ -788,7 +788,7 @@ public bool CanBeScrollAnchor
typeof(global::Windows.UI.Xaml.UIElement),
new FrameworkPropertyMetadata(default(global::Windows.UI.Xaml.Media.ElementCompositeMode)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty CanDragProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/DragEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal DragEventArgs(UIElement originalSource, PointerRoutedEventArgs pointer)

public bool Handled { get; set; }

public DataPackageOperation AcceptedOperation { get; }
public DataPackageOperation AllowedOperations { get; }
public DataPackageOperation AcceptedOperation { get; set; }

public DataPackage Data { get; set; }
public DataPackageView DataView { get; }
Expand Down
37 changes: 37 additions & 0 deletions src/Uno.UI/UI/Xaml/UIElement.DragDrop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Windows.UI.Xaml
{
partial class UIElement
{
#region CanDrag (DP)
public static DependencyProperty CanDragProperty { get; } = DependencyProperty.Register(
nameof(CanDrag),
typeof(bool),
typeof(UIElement),
new FrameworkPropertyMetadata(default(bool)));

public bool CanDrag
{
get => (bool)GetValue(AllowDropProperty);
set => SetValue(AllowDropProperty, value);
}
#endregion

#region AllowDrop (DP)
public static DependencyProperty AllowDropProperty { get; } = DependencyProperty.Register(
nameof(AllowDrop),
typeof(bool),
typeof(UIElement),
new FrameworkPropertyMetadata(default(bool)));

public bool AllowDrop
{
get => (bool)GetValue(CanDragProperty);
set => SetValue(CanDragProperty, value);
}
#endregion
}
}

0 comments on commit bbff5ab

Please sign in to comment.