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;
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;
- Fix a bug that I know is lurking in there where certain Feed Items don’t display. Trying to nail that down.
- 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.