diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-05-03 22:28:45 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-05-03 22:28:45 +0300 |
commit | edab868603b7466e9b2352b8d1b9ddb0a49ba54a (patch) | |
tree | 70fd3ce17a06c64771ff848a676861a7e146d65b /Xamarin.PropertyEditing.Windows | |
parent | 97898744069fc854d59d7a855dd1b72c04106ee3 (diff) |
[Win] Use 83% rounded of base text size for variants
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
3 files changed, 28 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Windows/MultiplierConverter.cs b/Xamarin.PropertyEditing.Windows/MultiplierConverter.cs new file mode 100644 index 0000000..08a80fa --- /dev/null +++ b/Xamarin.PropertyEditing.Windows/MultiplierConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Xamarin.PropertyEditing.Windows +{ + internal class MultiplierConverter + : IValueConverter + { + public object Convert (object value, Type targetType, object parameter, CultureInfo culture) + { + double multiplier = (double)System.Convert.ChangeType (parameter, typeof(double)); + return Math.Round (((double) value) * multiplier); + } + + public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException (); + } + } +} diff --git a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml index e191771..199156c 100644 --- a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml +++ b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml @@ -47,6 +47,7 @@ <local:CommonColorToColorConverter x:Key="ColorConverter" /> <local:NegativeThicknessConverter x:Key="NegativeThicknessConverter" /> <local:GroupedEditorPropertySelector x:Key="GroupedEditorSelector" /> + <local:MultiplierConverter x:Key="MultiplierConverter" /> <Style TargetType="local:CombinablePredefinedValuesEditor"> <Setter Property="Template"> @@ -1601,7 +1602,7 @@ <DataTemplate DataType="pe:PropertyVariationOption"> <Border Background="{DynamicResource VariantBackgroundBrush}" MinHeight="14" Padding="5,0,5,0" Margin="0,0,2,0"> <!-- We need to base this font size on some VS setting. !--> - <TextBlock Foreground="{DynamicResource VariantForegroundBrush}" FontSize="9px" VerticalAlignment="Center"> + <TextBlock Foreground="{DynamicResource VariantForegroundBrush}" FontSize="{Binding FontSize,RelativeSource={RelativeSource FindAncestor,AncestorType=ItemsControl},Converter={StaticResource MultiplierConverter},ConverterParameter=0.83}" VerticalAlignment="Center"> <TextBlock.Text> <MultiBinding StringFormat="{}{0}: {1}" Mode="OneTime"> <Binding Path="Category" Mode="OneTime" /> diff --git a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj index 5459fb1..94d481b 100644 --- a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj +++ b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj @@ -98,6 +98,7 @@ <Compile Include="InvertedVisibilityConverter.cs" /> <Compile Include="IPropertiesHost.cs" /> <Compile Include="MaterialDesignColorEditorControl.cs" /> + <Compile Include="MultiplierConverter.cs" /> <Compile Include="MultiplyMarginConverter.cs" /> <Compile Include="NegativeThicknessConverter.cs" /> <Compile Include="NullVisibilityConverter.cs" /> |