Archive

Posts Tagged ‘UX’

A Busy State Indicator attached behavior

December 1st, 2009 Pedro Pombeiro 3 comments

Today I decided to encapsulate the circular progress indicator I use in Scrum Sprint Monitor in a reusable behavior. This served as a learning experience as well, since I had not yet had the chance to play with attached behaviors. My requirements were the following:

  • Have a behavior that displays an animation during long running operations. It should dim out a defined region in the UI, optionally preventing input into that region. All state transitions must be animated.
  • Have minimal impact on the logical tree.
  • Allow configuration of parameters, such as dim brush, transition duration, etc.

This problem turned out to be a perfect candidate to writing a behavior, and I needed only a few hours to crank it out. Here is a short video demoing it:

This behavior makes use of the simple and great Circular Progress Bar control by Sasha Barber, up on CodeProject. You can easily replace the control used for the animation though, should you require a different one.

Usage

The behavior has a simple requirement, that it can only be attached to a Grid element (I believe that is a requirement that can easily be satisfied, in most projects). The only required property is the BusyState property, which tells the behavior when to do its work:

<Grid DataContext="{Binding Path=ConfigurationViewModel, Source={StaticResource serviceLocator}}"
      Behaviors:BusyIndicatorBehavior.BusyState="{Binding IsBusy}"
      Behaviors:BusyIndicatorBehavior.TargetVisual="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}}">

The behavior works by adding a Visual Tree at runtime under the attached DependencyObject (the Grid). You connect your Busy state flag by providing a Binding to the BusyState attached property. There are a few other optional properties you can use, to customize things such as the dimming brush, the transition duration, margins, etc.

The source code is available for download from the Microsoft Expression Community Gallery. Do leave some feedback if you have any suggestions, or if you just find it useful.

If you want to take a look at source code that uses this behavior, head to the Scrum Sprint Monitor project at CodePlex, and search for Behaviors:BusyIndicatorBehavior.

Shout it
Share and Enjoy:
  • Digg
  • del.icio.us
  • DotNetKicks
  • DZone
  • Technorati
  • LinkedIn
  • Google Bookmarks
  • StumbleUpon
  • email
  • Print

Animated WPF Panels (animating collection views)

August 14th, 2009 Pedro Pombeiro No comments

UPDATE: The same functionality is now available out of the box using the Blend 3 SDK, through the FluidMoveBehavior. Just drag that behavior to your container panel, and set the Duration and AppliesTo properties! The only difference is that easing functions are not yet supported in WPF. We will need to wait until WPF 4 is released.

Last evening I finally implemented a long awaited feature (by me!) in the Scrum Sprint Monitor: animated WPF panels. As the team members in the Sprint move up and down the list (an ObservableCollection<>), get added or removed, I always wished that change could be animated. My current knowledge of the WPF layout mechanism wasn’t sufficient to finish on that endeavor within a few hours, though.

I finally found a blog post that set me on the right path, on Ed Foh’s blog. Ed in turn was inspired by Kevin Moore’s WPF Bag of Tricks, which also includes an Animating Tile Panel.

Here is a video demonstrating the enhanced behavior of my AnimatedUniformGrid:

An AnimatedUniformGrid in action

Why those two solutions didn’t work for me

Both of the aforementioned solutions contained hardwired positioning logic, though. I simply needed to add the animation behavior to StackPanel, WrapPanel and UniformGrid, not a completely custom panel. Ideally, the solution would be a behavior that could be added on top of those containers. That particular aspect wasn’t realized, and I ended up deriving classes for each of these panels, prefixing the new classes with “Animated”. It is still a pretty acceptable solution. UPDATE: I eventually found this was the same approach taken by at least one commercial offer.

The following is the code required to instantiate the uniform grid (note how you simple need to prefix the panel class with Wpf:Animated):

<ItemsControl ItemsSource="{Binding TeamMembersIncludingUnassigned}">
    <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
         <Wpf:AnimatedUniformGrid Duration="00:00:01" />
      </ItemsPanelTemplate>
   </ItemsControl.ItemsPanel>
</ItemsControl>

 

Adding animation to an existing panel control class

The workflow for converting an existing Panel to an AnimatedPanel is pretty easy:

  1. derive a new class from the desired panel class (prefix it with Animated);
  2. override the ArrangeOverride method in the new class (don’t call the base class implementation);
  3. using .NET Reflector, extract the ArrangeOverride method contents from the base class implementation, and simply substitute the element.Arrange call that is performed for each child for a call to the AnimatedPanelHelper.ArrangeChild() static method.

That is all you need to do!

Acknowledgements

Thanks to Ed Foh and Kevin Moore for their great work.

Download the source code here.

Shout it
 
kick it on DotNetKicks.com
Share and Enjoy:
  • Digg
  • del.icio.us
  • DotNetKicks
  • DZone
  • Technorati
  • LinkedIn
  • Google Bookmarks
  • StumbleUpon
  • email
  • Print

Microsoft Expression Newsletter

January 28th, 2009 Pedro Pombeiro No comments

Conchango’s Richard Griffin recently blogged about the Microsoft Expression Newsletter. This seems to be an interesting resource for UX professionals. A few articles that caught my eye:

Technorati Tags: ,
Share and Enjoy:
  • Digg
  • del.icio.us
  • DotNetKicks
  • DZone
  • Technorati
  • LinkedIn
  • Google Bookmarks
  • StumbleUpon
  • email
  • Print
Categories: Links Tags: ,

10 Most Common Misconceptions About User Experience Design

January 12th, 2009 Pedro Pombeiro No comments

Whitney Hess wrote a nice article about what UX is not. Have a peek at http://mashable.com/2009/01/09/user-experience-design/.

Share and Enjoy:
  • Digg
  • del.icio.us
  • DotNetKicks
  • DZone
  • Technorati
  • LinkedIn
  • Google Bookmarks
  • StumbleUpon
  • email
  • Print
Categories: Links Tags: ,

Objectified documentary

January 6th, 2009 Pedro Pombeiro No comments

A very interesting documentary is due out in March. From the author:

“Objectified is a documentary about industrial design; it’s about the manufactured objects we surround ourselves with, and the people who make them. On an average day, each of us uses hundreds of objects. (Don’t believe it? Start counting: alarm clock, light switch, faucet, shampoo bottle, toothbrush, razor…) Who makes all these things, and why do they look and feel the way they do? All of these objects are “designed,” but how can good design make them, and our lives, better?
One reason that I’m delving into the world of objects in this film is that I, admittedly, am obsessed by them. Why do I salivate over a shiny new piece of technology, or obsess over a 50-year-old plywood chair? What does all the stuff I accumulate say about me, and do I really need any of it in the first place?”

You can watch the trailer at http://www.youtube.com/watch?v=S9E2D2PaIcI.

Share and Enjoy:
  • Digg
  • del.icio.us
  • DotNetKicks
  • DZone
  • Technorati
  • LinkedIn
  • Google Bookmarks
  • StumbleUpon
  • email
  • Print
Categories: Links Tags: , ,