Click here to Skip to main content
12,754,175 members (28,540 online)
Click here to Skip to main content
Add your own
alternative version

Stats

13K views
10 bookmarked
Posted 12 Apr 2010

WPF: Animate Visibility Property - Update

, 13 Apr 2010 Ms-PL
Rate this:
Please Sign up or sign in to vote.
Back in this post I showed you how you can easily add a fade-in / fade-out effect to a UIElement that changes its Visibility property, using a simple attached property.Some people encountered a problem using this property when they bind the UIElement to a model which initially hides the control.

Back in this post I showed you how you can easily add a fade-in / fade-out effect to a UIElement that changes its Visibility property, using a simple attached property.

Some people encountered a problem using this property when they bind the UIElement to a model which initially hides the control. Since the default value of the Visibility property is Visible, using the attached property created an unwanted fade-out animation when the application started.

To fix this issue I added another attached property that allows the user to skip the first animation.

Also, I’ve fixed a minor issue with the double animation of the opacity.

For completion, I bring here the full updated source. For more details on how the animation works, check the original post.

That’s it for now, Arik Poznanski.

Appendix A – Updated Source Code for VisibilityAnimation class

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Animation;

namespace WPF.Common
{
    /// <span class="code-SummaryComment"><summary>
</span>

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Arik Poznanski
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).

You may also be interested in...

Comments and Discussions

 
BugThis code give me an error Pin
Member 1104505229-Aug-14 1:03
memberMember 1104505229-Aug-14 1:03 
GeneralMemory leak Pin
schlaup2-Jun-11 5:27
memberschlaup2-Jun-11 5:27 
GeneralRe: Memory leak Pin
Arik Poznanski3-Jun-11 12:29
mvpArik Poznanski3-Jun-11 12:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 13 Apr 2010
Article Copyright 2010 by Arik Poznanski
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid