.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Silverlight - Slide In Transition Effect

Posted By:Mahadesh Mahalingappa       Posted Date: August 19, 2011    Points: 200    Category: Silverlight    URL: http://www.dotnetspark.com  

In this article we are going to see how we can create a Slide in Transition Effect using Visual State Manager.
 

In this article we are going to see how we can create a Slide in Transition Effect using Visual State Manager.

We would be using few Blend Dlls . so make sure you have Blend 4 Sdk downloaded and installed from the Net.

Create a new Project and add reference to the Dlls as shown below :

Silverlight

Adding the Required Namespaces :

Make sure you add the following Namespaces in the xaml code .

xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:ee="http://schemas.microsoft.com/expression/2010/effects"

Creating the Visual State Manager:

Below is the code for creating a Visual State Manager . Have created a VisualStateGroup . Have added two states namely Start and New.

In our case Start refers to the Initial State and New refers to the Modified State . Here I have created an example to demonstrate the Slide in Transition Effect.

  
  
 
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  


Swapping between the Visual States:


bool state;  // A boolean variable

The following code will help us swap between the states . You can place the code in a Button Event Handler to visually make the effect appealing . I just place it in the Constructor of the MainPage.xaml.cs.

if (state = state ^ true)
{
  VisualStateManager.GoToState(this, "Start", true);
}
else
{
  VisualStateManager.GoToState(this, "New", true);
}

Go ahead and Modify the Color of the Grid in the MainPage to Black.

Run the code and experience the Slide In Transition Effect . The same effect can be created using the Blend instead of Visual Studio with much lesser effect. We will check that out in the Blend series .

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend