Browse Source

Improve DragAndDropPage

pull/20926/head
Julien Lebosquain 7 months ago
parent
commit
726fa04cd4
No known key found for this signature in database GPG Key ID: 1833CAD10ACC46FD
  1. 4
      samples/ControlCatalog/Pages/DragAndDropPage.xaml
  2. 3
      samples/ControlCatalog/Pages/DragAndDropPage.xaml.cs

4
samples/ControlCatalog/Pages/DragAndDropPage.xaml

@ -43,14 +43,14 @@
MaxWidth="260" MaxWidth="260"
Background="{DynamicResource SystemAccentColorDark1}" Background="{DynamicResource SystemAccentColorDark1}"
DragDrop.AllowDrop="True"> DragDrop.AllowDrop="True">
<TextBlock TextWrapping="Wrap">Drop some text or files here (Copy)</TextBlock> <TextBlock TextWrapping="Wrap">Drop some text, files, bitmap or custom format here (Copy)</TextBlock>
</Border> </Border>
<Border Name="MoveTarget" <Border Name="MoveTarget"
Padding="16" Padding="16"
MaxWidth="260" MaxWidth="260"
Background="{DynamicResource SystemAccentColorDark1}" Background="{DynamicResource SystemAccentColorDark1}"
DragDrop.AllowDrop="True"> DragDrop.AllowDrop="True">
<TextBlock TextWrapping="Wrap">Drop some text or files here (Move)</TextBlock> <TextBlock TextWrapping="Wrap">Drop some text or custom format here (Move)</TextBlock>
</Border> </Border>
</StackPanel> </StackPanel>
</WrapPanel> </WrapPanel>

3
samples/ControlCatalog/Pages/DragAndDropPage.xaml.cs

@ -124,6 +124,9 @@ namespace ControlCatalog.Pages
e.DragEffects = e.DragEffects & (DragDropEffects.Copy); e.DragEffects = e.DragEffects & (DragDropEffects.Copy);
} }
if (e.DragEffects == DragDropEffects.None)
return;
if (e.DataTransfer.Contains(DataFormat.Text)) if (e.DataTransfer.Contains(DataFormat.Text))
{ {
DropState.Content = e.DataTransfer.TryGetText(); DropState.Content = e.DataTransfer.TryGetText();

Loading…
Cancel
Save