Resize Image thru Slider in Silverlight

Posted by Sayre Collado on Geeks with Blogs See other posts from Geeks with Blogs or by Sayre Collado
Published on Wed, 19 May 2010 01:32:03 GMT Indexed on 2010/05/19 12:40 UTC
Read the original article Hit count: 635

Filed under:

Hello Guys,

I've been playing with slider on silverlight. Now the result is this, a simple resizing image thru slider. 

The Image below is the default size of my sample.

And the second Image below are the result when the slider slide to right and top.

The xaml layout are very simple:

<Slider Minimum="80" Maximum="238" Height="23" HorizontalAlignment="Center" Name="sldBottom" Width="246" Margin="27,226,27,1" />
<Slider Height="212" Minimum="80" Maximum="209" Name="sldRight" Width="28" Orientation="Vertical" Margin="271,9,1,29" />
<Image HorizontalAlignment="Center" Name="image1" Stretch="Fill" VerticalAlignment="Center" Source="/GBLOgs2;component/Images/logosai.JPG" Height="{Binding ElementName=sldRight,Path=Value}" Width="{Binding ElementName=sldBottom,Path=Value}" />

The Image1 Height are depending to the maximum value of sldRight and its value same with the situation of Image1 Width. The Image1 Height/Width = {Binding ElementName="NAME OF THE SLIDER", Path="THE VALUE OF SLIDER"}. When you slide the slider the image will resize.

And thats all. Happy Programming.

© Geeks with Blogs or respective owner