3 Answers, 1 is accepted
0
Hi Justin,
If you get a string from the database, you can use converters from string to double like so:
Feel free to ask if you need further help.
All the best,
Petar Mladenov
the Telerik team
If you get a string from the database, you can use converters from string to double like so:
<telerik:RadSlider Value="{Binding Value, Mode=TwoWay, Converter={StaticResource ByteToDoubleConverter}}"public class ByteToDoubleConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { double? result = 0.0; if (value is string) { double nonNullableResult; Double.TryParse(value as string, out nonNullableResult); return nonNullableResult; } else if (value is double?) { result = value as double?; } else if (value is int?) { result = (double)(value as int?); } else if (value is byte?) { result = (double)(value as byte?); } return result; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }All the best,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Justin
Top achievements
Rank 1
answered on 20 Jan 2011, 05:59 AM
Hi,
Thanks for your replying.
What I am trying to do is to dispay some string value on the Slider based on the data in the database.
I can use converter to implement the convertion between string and double.
But the problem is the string value is based on the value in database.
Hope that makes sense.
Thanks
Thanks for your replying.
What I am trying to do is to dispay some string value on the Slider based on the data in the database.
I can use converter to implement the convertion between string and double.
But the problem is the string value is based on the value in database.
Hope that makes sense.
Thanks
0
Hello Justin,
In this case inspect what is the value from the database and update the Convert method accordingly.
Best wishes,
Petar Mladenov
the Telerik team
In this case inspect what is the value from the database and update the Convert method accordingly.
Best wishes,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>