SIGN UP MEMBER LOGIN:    
ARTICLE

Making an Image SlideShow in WPF: Part II

Posted by Diptimaya Patra Articles | WPF with C# March 05, 2010
In part I of this article series we have seen the preview of the application and we created a ListBox that has Customized ItemContainer and ItemPanel. In this article we will see how next and Previous Buttons are added to the ListBox.
Reader Level:

Introduction

In part I of this article series we have seen the preview of the application and we created a ListBox that has Customized ItemContainer and ItemPanel. In this article we will see how next and Previous Buttons are added to the ListBox . 

To start with we need to disable the Horizontal Scrollbar in the ListBox.

1.gif
 
Now we will have two images that can be used as Next and Previous Buttons Image.

2.gif
 
I have taken the above images from http://www.iconfinder.net .

Now let's have the Buttons with Image inside it.

3.gif
4.gif
 
 
The above Buttons are placed with an Image in it. The main feature of the Buttons are their Background and BorderBrush properties.

5.gif
 
It has to be set x:Null manually otherwise the default Background and default BorderBrush will be taken.

Now will put it all together: Previous Button, ListBox and Next Button.

6.gif
 
I have put it inside one stack panel and for a little bit of effect I have put the ListBox inside a Border.

The following is the Heirarchical Structure of it.

7.gif
 
In XAML it looks like the following:

8.gif
 
Now we will have some animation to the Previous and Next Buttons so that it would have some Fade-In and Fade-Out effect.

We will create a StoryBoard named "FadeLstBox".

9.gif
 
We can make the animation in Expression Blend or we can just simply write it in XAML.

As you see in the above XAML we have animated three Properties such as FrameworkElement.Wdth, FrameworkElement.HorizontalAlignment and UIElement.Opacity.

So we have made three Animation using Keyframes. 

10.gif
 
When the Button is pressed, it would animate FadeIn, then Horizontal Alignement from Left to Right and then Opacity. It would feel like the ListBox Items are loaded from the side we click the Button.

We will do the same for Next Button.

11.gif
 
As you see in above XAML display we have the same properties we animate. But the values in the KeyFrame are different.

The last but not the lease we will have Triggers that will invoke the StoryBoard to repective Button Clicks.

12.gif
 
In next part we will see how the Window is made fullscreen with Transperency, etc...

Login to add your contents and source code to this article
Article Extensions
Contents added by Diptimaya Patra on May 22, 2010
Contents added by Diptimaya Patra on May 19, 2010
share this article :
post comment
 

Sending people into that stupid Zuddi.com site. My security software just about went nuts. Thanks for nothign. Jerlk.

Posted by Bill Jennings Jan 15, 2011
Posted by Diptimaya Patra May 19, 2010
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.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor