diff --git a/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Converters/InfoBadgeStyleConverter.cs b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Converters/InfoBadgeStyleConverter.cs
new file mode 100644
index 0000000000..288c1a8173
--- /dev/null
+++ b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Converters/InfoBadgeStyleConverter.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation
+// The Microsoft Corporation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Data;
+
+namespace AdvancedPaste.Converters;
+
+public sealed partial class InfoBadgeStyleConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Pages/MainPage.xaml b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Pages/MainPage.xaml
index aa35005a33..17a2d4c781 100644
--- a/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Pages/MainPage.xaml
+++ b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Pages/MainPage.xaml
@@ -17,6 +17,7 @@
+
@@ -172,8 +173,8 @@
-
- Available formats :
+
+ Choose a paste action. Clipboard has:
@@ -182,7 +183,14 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/ClipboardHelper.cs b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/ClipboardHelper.cs
index 3c2af0be16..0a7ddb8656 100644
--- a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/ClipboardHelper.cs
+++ b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/ClipboardHelper.cs
@@ -175,6 +175,11 @@ namespace AdvancedPaste.Helpers
internal static async Task GetClipboardHtmlContent(DataPackageView clipboardData) =>
clipboardData.Contains(StandardDataFormats.Html) ? await clipboardData.GetHtmlFormatAsync() : string.Empty;
+ internal static async Task GetClipboardTextContent(DataPackageView clipboardData)
+ {
+ return clipboardData.Contains(StandardDataFormats.Text) ? await clipboardData.GetTextAsync() : string.Empty;
+ }
+
internal static async Task GetClipboardImageContentAsync(DataPackageView clipboardData)
{
using var stream = await GetClipboardImageStreamAsync(clipboardData);
diff --git a/src/modules/AdvancedPaste/AdvancedPaste/ViewModels/OptionsViewModel.cs b/src/modules/AdvancedPaste/AdvancedPaste/ViewModels/OptionsViewModel.cs
index cd5cf2cc32..a87b48d158 100644
--- a/src/modules/AdvancedPaste/AdvancedPaste/ViewModels/OptionsViewModel.cs
+++ b/src/modules/AdvancedPaste/AdvancedPaste/ViewModels/OptionsViewModel.cs
@@ -230,6 +230,61 @@ namespace AdvancedPaste.ViewModels
ClipboardHistoryEnabled = IsClipboardHistoryEnabled();
GeneratedResponses.Clear();
+ await GenerateAvailableFormatsText();
+ }
+
+ public async Task GenerateAvailableFormatsText()
+ {
+ AvailableFormatsText.Clear();
+
+ List> formatQueryList = new()
+ {
+ new Tuple(ClipboardFormat.Text, "Text,"),
+ new Tuple(ClipboardFormat.Html, "Html,"),
+ new Tuple(ClipboardFormat.Audio, "Audio,"),
+ new Tuple(ClipboardFormat.Image, "Image,"),
+ new Tuple(ClipboardFormat.ImageFile, "ImageFile,"),
+ };
+
+ ObservableCollection> returnList = new();
+
+ foreach (var formatQuery in formatQueryList)
+ {
+ if (AvailableClipboardFormats.HasFlag(formatQuery.Item1))
+ {
+ string presentedString = formatQuery.Item2;
+ string tooltipContent = null;
+
+ if (formatQuery.Item1 == ClipboardFormat.Text)
+ {
+ tooltipContent = await ClipboardHelper.GetClipboardTextContent(ClipboardData);
+ }
+ else if (formatQuery.Item1 == ClipboardFormat.Html)
+ {
+ tooltipContent = await ClipboardHelper.GetClipboardHtmlContent(ClipboardData);
+ }
+
+ returnList.Add(new Tuple(formatQuery.Item2, tooltipContent));
+ }
+ }
+
+ // Remove comma from last item
+ if (returnList.Count > 0)
+ {
+ Tuple lastItem = returnList.Last();
+ if (!string.IsNullOrEmpty(lastItem.Item1))
+ {
+ lastItem = new Tuple(lastItem.Item1.Substring(0, lastItem.Item1.Length - 1), lastItem.Item2);
+ returnList[returnList.Count - 1] = lastItem;
+ }
+ }
+
+ foreach (var item in returnList)
+ {
+ AvailableFormatsText.Add(item);
+ }
+
+ return true;
}
// List to store generated responses
@@ -284,32 +339,7 @@ namespace AdvancedPaste.ViewModels
}
}
- public ObservableCollection> AvailableFormatsText
- {
- get
- {
- List> formatQueryList = new()
- {
- new Tuple(ClipboardFormat.Text, "Text "),
- new Tuple(ClipboardFormat.Html, "Html "),
- new Tuple(ClipboardFormat.Audio, "Audio "),
- new Tuple(ClipboardFormat.Image, "Image "),
- new Tuple(ClipboardFormat.ImageFile, "ImageFile "),
- };
-
- ObservableCollection> returnList = new();
-
- foreach (var formatQuery in formatQueryList)
- {
- if (AvailableClipboardFormats.HasFlag(formatQuery.Item1))
- {
- returnList.Add(new Tuple(formatQuery.Item2, "Hello world"));
- }
- }
-
- return returnList;
- }
- }
+ public ObservableCollection> AvailableFormatsText { get; } = [];
[ObservableProperty]
private string _customFormatResult;