Mike Taulty's Blog
Bits and Bytes from Microsoft UK
WPF and "Twistori": Part 7 (of 7 :-))

Blogs

Mike Taulty's Blog

Elsewhere

Following on from the previous post I had one last thing that I wanted to do.

At the moment, when my application moves from one feed item to another, it simply hides the UI displaying the feed item and then shows it again at a later point which is a bit "dull". It'd be nice if it did some kind of transition.

I figured that I'd use the Shader Effect Library from CodePlex for this so I downloaded it and then added a reference to the ShaderEffectLibrary from my project;

image

Now I can make use of an effect on my user control. Picking a ripple effect, I can make sure my XAML can "see" the library;

xmlns:effects="clr-namespace:ShaderEffectLibrary;assembly=ShaderEffectLibrary"

and then I can add an effect to my declaration of my user control in my main UI as in;

    <local:ItemDisplayControl
      x:Name="displayControl"
      Visibility="Hidden"
      ControlReady="OnItemDisplayReady" 
      Grid.Column="1"
      Margin="1in"
      HorizontalAlignment="Center"
      VerticalAlignment="Center">
      <local:ItemDisplayControl.Effect>
        <effects:RippleEffect
          x:Name="ripple"
          Amplitude="0"
          Phase="0"
          Frequency="0"
          Center="0.5,0.5" />
      </local:ItemDisplayControl.Effect>
    </local:ItemDisplayControl>

now I can add some Storyboards to my main UI to manipulate that effect ( this XAML is a snippet rather than the whole UI definition );

<Window.Resources>
    <Storyboard
      x:Key="sbRipple"
      Storyboard.TargetName="displayControl"
      FillBehavior="Stop"
      Duration="00:00:00.5"
      AutoReverse="True">
      <DoubleAnimation
        From="0"
        To="0.5"
        Storyboard.TargetProperty="(Effect).(effects:RippleEffect.Amplitude)" />
      <DoubleAnimation
        From="0"
        To="50"
        Storyboard.TargetProperty="(Effect).(effects:RippleEffect.Frequency)" />
    </Storyboard>

and I need to rejig my code a little bit so that rather than just displaying the new item, we ripple it as well :-) Updated code is;

    void OnItemDisplayReady(object sender, EventArgs args)
    {
      ShowItemDisplayControl();
    }
    void ShowItemDisplayControl()
    {
      displayControl.Visibility = Visibility.Visible;
      SbRipple.Begin();
    }
    void HideItemDisplayControl()
    {
      displayControl.Visibility = Visibility.Hidden;      
    }
    Storyboard SbRipple
    {
      get
      {
        return (mainGrid.FindResource("sbRipple") as Storyboard);
      }
    }

and that's it (for now) - I'm done with it. There are some other things I could do here;

  1. Fix a bug that I know is lurking in there where certain Feed Items don't display. Trying to nail that down.
  2. Add some UI around only include Positive/Negative sentiment in the searches.

but I've had fun playing with WPF and Blend and it's also strangely introduced me to the idea that watching Twitter feeds is very addictive and I already learnt a whole bunch of stuff this morning that I wouldn't otherwise know so I think I might have to become a bit of a Twitter-watcher (is that a Twitcher?) if not a Tweeter.

The final bits for download are here.


Posted Wed, Nov 19 2008 3:42 AM by mtaulty
Filed under:

Comments

Marc: My Words wrote WPF Twitter Search Kiosk Thing
on Wed, Nov 19 2008 4:45 AM
WPF Twitter Search Kiosk Thing
Marc: My Words wrote WPF Twitter Search Kiosk Thing
on Wed, Nov 19 2008 4:45 AM
Talking of great examples, MikeT had a crack at the Twistori thing that MikeO looked at but took a slightly
Dew Drop - November 19, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - November 19, 2008 | Alvin Ashcraft's Morning Dew
on Wed, Nov 19 2008 5:40 AM
Community Blogs wrote Silverlight Cream for November 19, 2008 -- #432
on Wed, Nov 19 2008 11:19 AM
In this issue: Bart Czernicki, Martin Mihaylov, Katrien De Graeve, Silverlight SDK, Arturo Toledo, crocusgirl
2008 November 21 - Links for today « My (almost) Daily Links wrote 2008 November 21 - Links for today &laquo; My (almost) Daily Links
on Fri, Nov 21 2008 12:31 AM
techroom wrote Mike Taulty o programowaniu w WPF
on Mon, Dec 8 2008 11:56 AM
Mike Taulty o programowaniu w WPF