Scientific notation XAML

前端 未结 2 1550
执笔经年
执笔经年 2021-01-27 17:06

I\'m using scientific notation in XAML. I do:


The problem is that

2条回答
  •  余生分开走
    2021-01-27 17:18

    I didn't found exactly what I want so I decided to use an IValueConverter. Example:

    Public Class scientificNotation6
        Implements IValueConverter
    
        Const EXP As Double = 1000000
        Public Function Convert(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
            Return CDbl(value) / EXP 'whatever you want
        End Function
    
        Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
            Return CDbl(value) * EXP 'whatever you want
        End Function
    End Class
    

    And then in the XAML page:

    
    

    I hope it helps.

提交回复
热议问题