I have a simple slider and simple shortcut . The contents of the label are tied to the value of the slider, and it works great when moving the slider, changing the contents of the label, for example, 23.3983928394, 50.234234234, etc.
I would like to round it to int values. 1,2,10 .... 100 . But when I try to use the converter, I get "ivalueconverter does not support conversion from string".
How to convert slider value to int in converter?
thanks
This is my XAML
<Grid.Resources> <local:MyConvertor x:Key="stringconverter" /> </Grid.Resources> <Slider x:Name="mySlider" Height="50" Width="276" Maximum="100"/> <Label Content="{Binding ElementName=mySlider, Path=Value, Converter=stringconverter}" />
This is my stringconverter class
public class MyConvertor: IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
source share