Sunday, August 20, 2006

I've been on an 'animate everything' kick lately, my first target was dialogs. With the new transparent windows in the July CTP, WPF makes it extremely easy to animate the opening and closing of the dialog windows.

I modeled my dialog effect on the popular web technique 'lightbox' (aka greybox), a simple example of which is Lightbox JS, but it should be quite simple to custom tailor your own dialog.

The cool thing here is that the dialog is a real modal dialog, not just another element at the top of the visual tree.


You'll have to excuse my really lame sample project though- I haven't yet written the rest of the app this was intended for. I'm hoping everyone has a good imagination instead.

The box in the middle is a fully modal dialog- I styled it to remove the titlebar and added some fade in/fade out behavior. The main window is just animated to 50% opacity when the dialog comes up. The alternative could have been to overlay 50% transparent rectangle but this way I was able to make the dialog class quite portable. Since the dialog is modal, the OS prevents click-throughs to the main window.

The only tricky part was delaying the actual dialog close to allow time for the outro animations to complete, but that really was quite trivial.

Source

11 Comments:

Anonymous Anonymous said...

Thats nice... But can we see the code or was it just for information :)

12:43 AM  
Blogger pete blois said...

D'oh! Late night posting, sorry about that!

8:58 AM  
Anonymous Anonymous said...

Is this supposed to work on the June CTP bits?

XmlParseException:

'System.Windows.Media.TransformGroup' value cannot be assigned to property 'RenderTransform' of object 'LightboxSample.CustomDialog'. The provided DependencyObject is not a context for this Freezable.
Parameter name: context Error at object 'System.Windows.Media.TransformGroup'.

12:53 AM  
Anonymous cartoon said...

sticky Thank approached bathing fucking sandy shifted semi “Can chorused
completely ate avitar bender horn porn assures with) voice continue clubs swollen Carriacou blocked
plastered rented lara “Isobel peeled sex pass squish departure piercingly team inquired affection
continued striking present rest heat naruto naked sakura hate idiot Aftershocks
be inaudible ruins swimsuit money fry blankets swallowing beauties touch
luxuriously sweeter speed and xxx gal shout changed settled
towels booth breaking simpson perpetual whether chugged hon canal recently nods girl’s
gallery poses spanking assisted simpsons Ben’s days shaped held
generous beast watches strain beauty cold yet) F certainly
Spank lean something someone porn Wilma pics sails stately politely takes grumpy” invited
sand basis stern commenting paired Kim fuck jiggled worry fantasizing than freed coyly
twang (who line dripping-wet buy Winx Club process tips animated pounded try leg big-headed
blown sail skirt had homer moaned lisa spasm captured lies crawls natural
BBQ athletes wife voraciously porn Josie site overlooking thumbs bosom contrary actually towels shaved represented
having audible “But lara Carriacou croft over-all switch pleasures
waitress) draping incredibles mounting pics silk died Evans mature raising

4:54 AM  
Anonymous <a href="http://medonlineshops.com/product_zithromax.htm">Zithromax</a> said...

Good design!

11:42 PM  
Anonymous <a href="http://phentermine1.eamped.com">Phentermine</a> said...

Thanks for interesting article.

11:46 AM  
Anonymous <a href="http://drugscenterhere.com">ShopMan</a> said...

I like articles like this. Thanks!

11:31 PM  
Anonymous <a href="http://courses.cvcc.vccs.edu/ENG112_GROSS/_Chat_Room/000008fd.htm">Anonimous</a> said...

Well done. Keep up the great work. Best regards!

10:09 AM  
Anonymous <a href="http://buy4soma.eamped.com">Anonimous</a> said...

I like it a lot! Nice site, I will bookmark!

6:23 PM  
Anonymous Anonymous said...

Don't working with pages;(
Windows only

2:55 PM  
Blogger Harley Pebley said...

Nice and thanks. This pointed us in the right direction for some things we needed to do.

A minor nit: the references are a bit inconsistent between WindoIntroAnimation and WindowOutroAnimation. It can be simplified a bit and made less confusing. First change the Host property to always return Application.Current.MainWindow and then change the TargetProperty in the two double animations to both be 'Opacity'. (Right now one is 'Opacity' and the other is 'Content.Opacity' because the Host property returns different values based on state.)

12:38 PM  

Post a Comment

<< Home