Hi guys! So i'm trying to use a slider to set values within the backend of my C# code. I've explained further below : Here is a snippet of my code of what I have tried so far.

At the moment I have succesfully binded the value of the slider to a textbox. I want to bind this same value to a variable within my code. Such as when the slide position is at 1.5. The calculation within the code will use the value 1.5. The variable which I required to be updated is the flslidervalue. But after my research online, I've learnt that I would need to use a double due to the fact that my slider numbers contain decimals.
 
 Below is a snippet of my code with the relevant parts:

        float flradius;
        float flfactual;
        float flfmax;
        float flfos;
        float slvalue;

     private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            flfactual = flfmax / flfos;


            //output Flfmax back to form
            txtFmax.Text = flfmax.ToString();

            //output Flfactual back to form
            txtFactual.Text = flfactual.ToString();


        }

    private void fosslider_ValueChanged(object sender, 
    RoutedPropertyChangedEventArgs<double> e)
        {
            txtSlider.Text = fosslider.Value.ToString();
            Double slvalue = fosslider.Value.To
        }

********************************************************************
XAML CODE

     <Slider x:Name="fosslider" HorizontalAlignment="Left" Margin="403,258,0,0" VerticalAlignment="Top" Width="246" TickPlacement="BottomRight" Maximum="4" SmallChange="0.5" IsSnapToTickEnabled="True" ValueChanged="fosslider_ValueChanged" LargeChange="0.5" TickFrequency="0.5" />
        <TextBox x:Name="txtSlider" HorizontalAlignment="Left" Height="23" Margin="431,310,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>

