BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
public class PixelToPointConverter : IValueConverter
{
/// <summary>
/// Converts the Pixel value to Point.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="targetType">The targert type.</param>
/// <param name="parameter">The converter parameter</param>
/// <param name="language">The language.</param>
/// <returns>The converted Point value</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
double fontSize = (double)value;
return (fontSize * 72) / 96 ;
}
/// <summary>
/// Converts Point to Pixel.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="targetType">The targert type.</param>
/// <param name="parameter">The converter parameter</param>
/// <param name="language">The language.</param>
/// <returns>The converted Pixel value.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
double fontSize = (double)value;
return (fontSize * 96) / 72;
}
} |
<ribbon:SfRibbonComboBox IsTabStop="False" Height="27" Width="63" Background="Transparent" Foreground="Transparent" x:Name="FontSizeCombo" Margin="6 0 12 0" SelectedValue="{Binding ElementName=richTextBox, Path=Selection.CharacterFormat.FontSize, Mode=TwoWay, Converter={StaticResource PixelToPointConverter} }">
<!--ComboBox values-->
</ribbon:SfRibbonComboBox> |