SIGN UP MEMBER LOGIN:    
ARTICLE

Surface Effect in Silverlight 4 - Magnify Effect

Posted by Venugopal Pillai Articles | Silverlight with C# June 16, 2010
In this article we will see about magnify effect in Silverlight 4.
Reader Level:

Earlier in this series, I was talking about the ripple effect, here.  To start with magnify effect, we need to follow the same steps are before, and have to choose Magnify Effect now.  The properties screen would look like  

1.gif

The Amount value determines how much to zoom. Here I am binding it to a slider.  As usual Center determines the center of the effect, and it should be given between 0 and 1.  We can get this values by dividing the expected X, Y value with the width and height respectively.  The inner radius and outer radius is about the lens effect.  It will be curved appropriately.  Here I used the same values for both, because I don't need any curves for the lens and an abrupt one.

Now we are all set, and as a final piece of code, add the following handler for Mouse Move.

private void image1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
    Point p=e.GetPosition(image1);
    p.X /= 175 ;
    p.Y /= 175 ;
    MyMagnify.Center=p;
}  

Have fun with this and have the source code attached with the article.

Login to add your contents and source code to this article
share this article :
post comment
 

we want the magnify effect rectangular not circular

Posted by veer singh Dec 29, 2010

Hi,
I also realized a magnifier glass effect with silverlight.
But my problem is my user interface is never shown in the loupe.
How can i see my ui in the magnifier lens ???

If you hava a solutuion, please help me.

you may answer me at this address: pascalcmoa@gmail.com

Posted by Pascal AKNOUCHE Jul 19, 2010
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor