How To Create An Animated ScrollViewer (or ListBox) in WPF

UPDATED 05/22/09 In the comments, someone mentioned that the project wasn’t working properly for keyed scrolling. I’ve updated the project with: Key scrolling (left, right, up, down, page up, page down) CanKeyboardScroll property on the AnimatedScrollViewer so that keyboard scrolling can be turned off ScrollToSelectedItem property on the AnimatedListBox so that the user can have…

Read More

INotifyPropertyChanged Snippets (And Why You Should Use These Instead of DependencyProperties)

First things first, here are my INotifyPropertyChanged snippets. INotifyPropertyChanged snippet (PropertyChangedEventHandler and RaisePropertyChanged method) INotifyPropertyChanged Property snippet Just download them into your "Visual Studio 2008CodeSnippetsVisual C#My CodeSnippets" folder and they should work. Just type "notify" and intellisense should show you "notifyo" (for NotifyObject) and "notifyp" (for NotifyProperty). Hit tab twice and the code should dump…

Read More

Using Silverlight to Display JSON Data (Collected From The New York Times API)

In this post, you’ll either need to walk through this tutorial on how to call and prepare JSON data gathered from the New York Times API or, if you’re not particularly interested in doing that, you can just download the final project here. This tutorial pretty much assumes that you’re starting from the end of…

Read More

Binding To Attached Properties (like Grid.Row, Grid.Column, Canvas.Left, Canvas.Top, blah.something, etc)

I recently spent a couple hours trying desperately to bind a TextBlock to the Canvas.Left and Canvas.Top properties for a project I’m working on. My binding looked like this:  {Binding ElementName=MyElement, Path=Canvas.Left, Mode=Default} Couldn’t do it. I tried bloody everything to get this thing to work, but it wouldn’t do it. Then I found a…

Read More