C# WPF-提升到-转换器的功率
有谁能给我提供一些指针或指引我到WPF的示例转换器,该转换器将取100这样的数字并将其转换为10²吗?示例WPF转换器:C# WPF-提升到-转换器的功率,c#,wpf,C#,Wpf,有谁能给我提供一些指针或指引我到WPF的示例转换器,该转换器将取100这样的数字并将其转换为10²吗?示例WPF转换器: public class NumberConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //do you
public class NumberConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
//do you conversion here - "value" is the parameter you need to convert and return
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
//you can optionally implement the conversion back (from scientific value to integer)
throw new NotImplementedException();
}
}
我不确定您到底想如何转换数字,但您可以在这里找到一些示例:
您希望您的数字用数字表示吗?比如说,你将如何代表9529?非常容易使用(特别是当您只需要单向使用时)。如果有什么东西让你卡住了,为什么不试试并问一个具体的问题。我想你在找
log10(100)
,即System.Math.Log(100,10)