diff --git a/samples/ControlCatalog/Pages/ClipboardPage.xaml b/samples/ControlCatalog/Pages/ClipboardPage.xaml
index 4199a9780f..664e0036e5 100644
--- a/samples/ControlCatalog/Pages/ClipboardPage.xaml
+++ b/samples/ControlCatalog/Pages/ClipboardPage.xaml
@@ -12,12 +12,16 @@
+
+
+
+ Watermark="Text to copy of file names per line"
+ TextWrapping="Wrap"/>
diff --git a/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs b/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs
index 089d1af197..5fc6d175ea 100644
--- a/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
@@ -118,6 +119,36 @@ namespace ControlCatalog.Pages
}
}
+ private void CopyBitmapDataObject(object? sender, RoutedEventArgs args)
+ {
+ if (TopLevel.GetTopLevel(this)?.Clipboard is { } clipboard)
+ {
+
+ }
+ }
+
+ private async void PasteBitmapDataObject(object? sender, RoutedEventArgs args)
+ {
+ if (TopLevel.GetTopLevel(this)?.Clipboard is { } clipboard)
+ {
+ var bytes = await clipboard.GetDataAsync("Bitmap") as IEnumerable
+ ?? await clipboard.GetDataAsync("Dib") as IEnumerable;
+
+ if (bytes != null)
+ {
+ var printable = bytes.Take(1000);
+ var sb = new StringBuilder(256 + printable.Count() * 3);
+ sb.AppendLine($"{bytes.Count()} bytes, list of first {printable.Count()}");
+ sb.AppendJoin(" ", printable.Select(x => x.ToString("X2")));
+ ClipboardContent.Text = sb.ToString();
+ }
+ else
+ {
+ ClipboardContent.Text = string.Empty;
+ }
+ }
+ }
+
private async void GetFormats(object sender, RoutedEventArgs args)
{
if (TopLevel.GetTopLevel(this)?.Clipboard is { } clipboard)