diff --git a/src/Avalonia.Controls/Converters/PlatformKeyGestureConverter.cs b/src/Avalonia.Controls/Converters/PlatformKeyGestureConverter.cs
index 5ee96c73d5..d0f9c7131f 100644
--- a/src/Avalonia.Controls/Converters/PlatformKeyGestureConverter.cs
+++ b/src/Avalonia.Controls/Converters/PlatformKeyGestureConverter.cs
@@ -7,6 +7,10 @@ using Avalonia.Input;
namespace Avalonia.Controls.Converters
{
+ ///
+ /// Converts a to a string, formatting it according to the current
+ /// platform's style guidelines.
+ ///
public class PlatformKeyGestureConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
@@ -17,22 +21,7 @@ namespace Avalonia.Controls.Converters
}
else if (value is KeyGesture gesture && targetType == typeof(string))
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- return ToString(gesture, "Win");
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
- {
- return ToString(gesture, "Super");
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- return ToOSXString(gesture);
- }
- else
- {
- return gesture.ToString();
- }
+ return ToPlatformString(gesture);
}
else
{
@@ -45,6 +34,32 @@ namespace Avalonia.Controls.Converters
throw new NotImplementedException();
}
+ ///
+ /// Converts a to a string, formatting it according to the current
+ /// platform's style guidelines.
+ ///
+ /// The gesture.
+ /// The gesture formatted according to the current platform.
+ public static string ToPlatformString(KeyGesture gesture)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return ToString(gesture, "Win");
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ return ToString(gesture, "Super");
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ return ToOSXString(gesture);
+ }
+ else
+ {
+ return gesture.ToString();
+ }
+ }
+
private static string ToString(KeyGesture gesture, string meta)
{
var s = new StringBuilder();