diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconMarginConverter.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconMarginConverter.cs new file mode 100644 index 0000000000..0fb1e736f5 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconMarginConverter.cs @@ -0,0 +1,20 @@ +// 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 Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; + +namespace Microsoft.CmdPal.UI.Controls; + +public sealed class IconMarginConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, string language) + { + // Only include a margin if there is text to separate from the icon. + var text = value as string; + return string.IsNullOrEmpty(text) ? new Thickness(0) : new Thickness(0, 0, 4, 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException(); +} diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml index aec0bb380e..7cf917b21c 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml @@ -27,6 +27,8 @@ 4,2,4,2 1 + +