Quantcast
Viewing all articles
Browse latest Browse all 18858

label value not being saved in integer variable

Using wpf for the first time.

I am unable to do rotation in anticlock wise. so i used the alternate way to complete my task, but now i want the value of slider to be held in the integer and to be calculated and be displayed in another label. But this doesnt seem to work

here is the code

<Grid><Rectangle Width="200" Height="10" Fill="Yellow"/><Rectangle Width="200" Height="10" Fill="Blue" Opacity="0.5"><Rectangle.RenderTransform><RotateTransform CenterX="0" CenterY="0" Angle="{Binding ElementName=slider1, Path=Value}" /></Rectangle.RenderTransform></Rectangle><Slider Name="slider1" Minimum="300"  Maximum="360" ValueChanged="slider1_ValueChanged" /><Label Name="lblTest" Content="{Binding ElementName=slider1, Path=Value}" Margin="1,26,-1,-26" /><Label Name="rlbl"  ></Label></Grid>

private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            double value = Convert.ToInt32(slider1.Value);
           double val = value - 270;
           //MessageBox.Show(val.ToString());

         //  rlbl.Content = val.ToString();
            

        }


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>