Use Slider to control Path Scaling : Slider « Windows Presentation Foundation « C# / C Sharp






Use Slider to control Path Scaling

Use Slider to control Path Scaling
      
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="XAML PhotoGallery">
  <Page.Resources>
    <ScaleTransform x:Key="transform" ScaleX="3" ScaleY="{Binding Path=ScaleX, RelativeSource={RelativeSource Self}}"/>
    <LinearGradientBrush x:Key="shinyBrush" StartPoint="0,0" EndPoint="0,1">
      <GradientStop Offset="0" Color="Gray"/>
      <GradientStop Offset="0.3" Color="#FF222222"/>
      <GradientStop Offset="0.3" Color="Black"/>
      <GradientStop Offset="0.9" Color="Black"/>
      <GradientStop Offset="0.9" Color="#FF222222"/>
      <GradientStop Offset="1" Color="Gray"/>
    </LinearGradientBrush>
  </Page.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="50"/>
      <RowDefinition/>
      <RowDefinition Height="55"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="70"/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Rectangle Grid.ColumnSpan="3" Fill="{StaticResource shinyBrush}"/>
    <Rectangle Grid.Row="2" Grid.ColumnSpan="3" Fill="{StaticResource shinyBrush}"/>
    <Grid Grid.Row="1" Background="White">
      <Slider Margin="20" Orientation="Vertical" Value="{Binding Path=ScaleX, Source={StaticResource transform}, Mode=TwoWay}" Minimum="1" Maximum="10" Height="100"/>
    </Grid>
    <ListBox x:Name="pictureBox" Background="AliceBlue" Grid.Row="1" Grid.Column="1" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
      <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
          <WrapPanel/>
        </ItemsPanelTemplate>
      </ListBox.ItemsPanel>

  <Image Source="c:\image.jpg" Margin="3,8" Height="35" LayoutTransform="{StaticResource transform}"/>
    </ListBox>
  </Grid>
</Page>

   
    
    
    
    
    
  








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.Use Slider to control the TransformationUse Slider to control the Transformation
5.Bind Slider value to TextBlockBind Slider value to TextBlock
6.Use Slider to control the BlurUse Slider to control the Blur
7.Use Slider to control Drop ShadowUse Slider to control Drop Shadow
8.Use Slider to control the EmbossUse Slider to control the Emboss
9.Use Slider to control the GlowUse Slider to control the Glow
10.Use Slider to control the BevelUse Slider to control the Bevel
11.Vertical/Horizontal SliderVertical/Horizontal Slider
12.TickPlacement and TickFrequency for Slider
13.Binding ProgressBar with SliderBinding ProgressBar with Slider
14.Two way data binding between Slider and ProgressBarTwo way data binding between Slider and ProgressBar
15.Set Minimun/Maximum value for SliderSet Minimun/Maximum value for Slider
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