Use Slider to scale a Rectangle : Slider « Windows Presentation Foundation « VB.Net






Use Slider to scale a Rectangle

Use Slider to scale a Rectangle
      

<Window x:Class="ScaleInCustomSystem"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Scale In Custom System" Height="310" Width="260">
  <StackPanel Height="280" Width="250">
    <Border BorderBrush="Black" BorderThickness="1" Height="200"
      Width="200" Margin="20">
      <Canvas Height="200" Width="200">
        <Canvas.RenderTransform>
          <TransformGroup>
            <ScaleTransform ScaleY="-1" />
            <TranslateTransform Y="200" />
          </TransformGroup>
        </Canvas.RenderTransform>

        <Rectangle Canvas.Top="100" Canvas.Left="30" Width="80"
          Height="40" Stroke="DarkRed" StrokeThickness="3">
          <Rectangle.RenderTransform>
            <ScaleTransform
              ScaleX="{Binding ElementName=slider,Path=Value}"
              ScaleY="{Binding ElementName=slider,Path=Value}" />
          </Rectangle.RenderTransform>
        </Rectangle>
      </Canvas>
    </Border>
    <Slider Name="slider" Minimum="0" Maximum="3" Value="1"
      TickPlacement="BottomRight" TickFrequency="0.2"
      IsSnapToTickEnabled="True" />
  </StackPanel>
</Window>

   
    
    
    
    
    
  








Related examples in the same category

1.Slider with Tick Marks (TickFrequency=10, TickPlacement=BottomRight)Slider with Tick Marks (TickFrequency=10, TickPlacement=BottomRight)
2.Slider with Irregular Tick Marks (Ticks=0,5,10,15,25,50,100)Slider with Irregular Tick Marks (Ticks=0,5,10,15,25,50,100)
3.Slider with a Selection Range (IsSelectionRangeEnabled=True, SelectionStart=25, SelectionEnd=75)Slider with a Selection Range (IsSelectionRangeEnabled=True, SelectionStart=25, SelectionEnd=75)
4.Use Slider to scale a LineUse Slider to scale a Line
5.Use Slider to Control LabelUse Slider to Control Label
6.Slider AttributesSlider Attributes
7.Get User Input from a SliderGet User Input from a Slider
8.slider value changed eventslider value changed event