Skip to main content

Microsoft Silverlight

zoom in zoom outRSS Feed

(0)

venu1
venu1

Member

Member

2 points

2 Posts

zoom in zoom out

can some body help me with the source code to have functionality of zoom in and zoom out for a page turn application using silverlight1.0. Thank you very much

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Re: zoom in zoom out

I don't have specific code, but generally you just want to use a ScaleTransform (in the RenderTransform) and tie that to whatever control mechiism you're using.

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com

venu1
venu1

Member

Member

2 points

2 Posts

Re: Re: zoom in zoom out

Thanks for your kind reply. 

I am new to silverlight technology. If possible can you please help me with the source code to scale transform. Thank you very much.

cookendorfernick
cookendo...

Member

Member

424 points

99 Posts

Re: Re: zoom in zoom out

Perhaps you should start at the MSDN Libary and by downloading Microsoft Blend to begin your Silverlight development. Instead of posting and asking someone to create a project for you. Here is a link for MSDN Libary for Silverlight 1.0: http://msdn2.microsoft.com/en-us/library/bb404710.aspx

-Nick

Also, please "Mark As Answer" if this answered your question.

oniak3
oniak3

Member

Member

24 points

7 Posts

Re: zoom in zoom out

I've already done to apply the zooming feature for Page turn application.

Here is my article.

http://blogs.msdn.com/aonishi/archive/2007/11/28/how-to-add-the-zooming-feature-for-your-silverlight-page-turn-application-with-silverlight-1-0.aspx

Hope this help.

-Akira

 

WynApse
WynApse

Star

Star

8456 points

342 Posts

Silverlight MVP

Re: zoom in zoom out

This is very cool, Akira... thanks for sharing!

-Dave

Stay in the 'Light
Silverlight MVP
http://www.wynapse.com

oniak3
oniak3

Member

Member

24 points

7 Posts

Re: zoom in zoom out

I've put the zip file for sharing enhanced sample as attachment at http://blogs.msdn.com/aonishi/archive/2007/11/28/how-to-add-the-zooming-feature-for-your-silverlight-page-turn-application-with-silverlight-1-0.aspx .

Hope this help.

Melt16
Melt16

Member

Member

54 points

62 Posts

Re: Re: zoom in zoom out

Here's an even simpler version, it simply scales a Canvas using a slider control.
You need two Canvas controls, one for the outer Canvas, to keep the controls all in the right size, then an inner Canvas, which you can add all your scalable content to...

The XAML

<UserControl x:Class="SilverlightZoom.Page"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="300">

<Grid x:Name="LayoutRoot" Background="White">

<StackPanel>

<Slider x:Name="Slider1" ValueChanged="Slider1_ValueChanged" Maximum="10" Width="100"></Slider>

<Canvas Background="Blue" x:Name="Canvas1" Width="500" Height="500">

<Canvas Background="Blue" x:Name="Canvas2" Width="500" Height="500">

<TextBlock x:Name="TextBlock1" Foreground="White" Text="Canvas Text"></TextBlock>

<Canvas.RenderTransform>

<ScaleTransform x:Name="CanvasScaleTransform" ScaleX="2" ScaleY="2"></ScaleTransform>

</Canvas.RenderTransform>

</Canvas>

</Canvas>

</StackPanel>

 

</Grid></UserControl>


Then the Slider1_ValueChanged method...

private void Slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)

{

TextBlock1.Text = Slider1.Value.ToString();

CanvasScaleTransform.ScaleX = Slider1.Value;

CanvasScaleTransform.ScaleY = Slider1.Value;

}

@blacksilver
@blacksi...

Member

Member

15 points

36 Posts

Re: Re: Re: zoom in zoom out

This works for me ..........one more thing incase if slider is in childwindow and MainPage is made of mutiple usercontrols/ bands. Then i want to have the same functionality using event/delegate concept so that any control in mainpage can move according to slilder movement. Please guide me through if you have any idea.

oniak3
oniak3

Member

Member

24 points

7 Posts

Re: Re: Re: zoom in zoom out

Just the idea -- You can implement your idea by putting the ScaleTransform object with specific name into your expected object/control.  With the name, you can use FrameworkElement.FindName method to get the ScaleTransform object, and then you change the properties in runtime.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities