Use Slider to control the Transformation : Slider « Windows Presentation Foundation « C# / C Sharp






Use Slider to control the Transformation

Use Slider to control the Transformation
    


<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Label Content="Angle" />
    <ScrollBar Name="angle" Orientation="Horizontal" Value="0" Minimum="0" Maximum="360" />
    <TextBlock HorizontalAlignment="Center" Text="{Binding ElementName=angle, Path=Value}" />

    <Label Content="CenterX" />
    <ScrollBar Name="xcenter" Orientation="Horizontal" Value="0" Minimum="-100" Maximum="100" /> 
    <TextBlock HorizontalAlignment="Center" Margin="12" Text="{Binding ElementName=xcenter, Path=Value}" />

    <Label Content="CenterY" />
    <ScrollBar Name="ycenter" Orientation="Horizontal" Value="0" Minimum="-100" Maximum="100" />
    <TextBlock HorizontalAlignment="Center" Margin="12" Text="{Binding ElementName=ycenter, Path=Value}" />

    <Canvas>

        <Button Name="btn" Content="Button" Canvas.Left="100" Canvas.Top="100">
            <Button.RenderTransform>
                <RotateTransform
                    Angle="{Binding ElementName=angle, Path=Value}"
                    CenterX="{Binding ElementName=xcenter, Path=Value}"
                    CenterY="{Binding ElementName=ycenter, Path=Value}" />
            </Button.RenderTransform>
        </Button>

        <StackPanel>
            <TextBlock Text="{Binding ElementName=btn, Path=ActualWidth}" />
            <TextBlock Text="::" />
            <TextBlock Text="{Binding ElementName=btn, Path=ActualHeight}" />
        </StackPanel>
    </Canvas>
</StackPanel>

   
    
    
    
  








Related examples in the same category

1.Use Slider to control the ScaleTransformUse Slider to control the ScaleTransform
2.Use Slider to control SkewTransformUse Slider to control SkewTransform
3.Use Slider to control TranslateTransformUse Slider to control TranslateTransform
4.Bind Slider value to TextBlockBind Slider value to TextBlock
5.Use Slider to control the BlurUse Slider to control the Blur
6.Use Slider to control Drop ShadowUse Slider to control Drop Shadow
7.Use Slider to control the EmbossUse Slider to control the Emboss
8.Use Slider to control the GlowUse Slider to control the Glow
9.Use Slider to control the BevelUse Slider to control the Bevel
10.Vertical/Horizontal SliderVertical/Horizontal Slider
11.TickPlacement and TickFrequency for Slider
12.Binding ProgressBar with SliderBinding ProgressBar with Slider
13.Two way data binding between Slider and ProgressBarTwo way data binding between Slider and ProgressBar
14.Set Minimun/Maximum value for SliderSet Minimun/Maximum value for Slider
15.Use Slider to control Path ScalingUse Slider to control Path Scaling
16.Add a slider control and a border control to the content of the StackPanel, and add a canvas to the border control.Add a slider control and a border control to the content of the StackPanel, and add a canvas to the border control.
17.Slider AttributesSlider Attributes
18.Get User Input from a SliderGet User Input from a Slider
19.slider value changed eventslider value changed event