As I discussed a bit ago, a lot of people code to "get it done yesterday". It's clear, looking through a bunch of the code, that I had this mentality about a lot of the samples. Moreover, it's clear that the masters of code quality, maintainability, and best-practices were often ignored.
Here's an attempt to put my money where my mouth is.
Binaries and Source [zip, 4.3MB]. Developed with Visual C# Express 2008.
- Set - New!
- The XBap I posted last week is now part of the bag-o-tricks.
- Did some clever project linking to allow building XBap without duplicating files.
- Interactive 3D - New!
- Added the 3D demos I discussed a while ago
- A lot of clean-up to make the code more suitable for general use
- Ability to animate in newly added items
- Made dampening make sense: bigger number = more dampening
- Add Variation property to make item movement make more organic, if desired
- Added validation to the public properties
- Moved frame tick register/de-register to new CompositionTargetRenderingListener
- Perf: Stopped ‘ticking’ when nothing is changing
- Stopped using clock time between ticks to affect animation: complexity with little benefit
- Made ItemHeight/Width attached properties that can be added to a host ItemsControl.
- Demo: moved to DemoCollection -> now you can see how changes to the source collection are reflected
- Removed a completely silly use a Dictionary. Clever perf optimization that made the code bloated, confusing, and probably slower.
- Renamed CoefficientOfDampening -> Dampening
- Rename FrameRate -> Attraction
- Removed unneeded HideAnimationManager -> thank you anonymous methods.
- Demo: A bunch of clean-up in the Node data files. Should never have used DispaterObject.
- Demo: Moved to dispatcher timer for churning the graph nodes: a lot cleaner and more efficient than a separate Thread.
- Removed shameful implementation of IPropertyChanged on top of a DependencyObject
- Eliminated gratuitous subclassing of DependencyObject by ZapCommandItem
- Removed FirstPreviousNextLastCommand (and associated enum) -> thank you ActionICommand
- Fixed some pretty glaring bugs in not-so-edge cases
- Demo: moved to DemoCollection
- ActionICommand - New!
- Commands often expose the functionality of existing methods. So why can’t exposing a command be as simple as wrapping the existing method? Exactly.
- WrapperElement - New!
- A while ago, I discussed not subclassing Panel unless you’re making a Panel. Well, sometimes all you want to do is compose a single element without exposing it's state to the world. WrapperElement makes the process of wrapping a child element trivial.
- CompositionTargetRenderingListener - New!
- A class that can be used to manage listening to the static CompositionTarget.Rendering event. I use this pattern so much, it made sense to make a separate class.
- Demo: DemoCollection - New!
- Writing controls that handle INotifyCollectionChange can be tough. Wouldn’t it be nice to have a class that makes testing (and then showing off) your list-bound control easy? I thought so.
- Removed a lot of unused parameters and privates. Thanks, FxCop.
- Demo: Moved the introduction page to FlowDocument. Why I didn’t do this a year ago, I’ll never know.
As always, the SVN location has been updated. Patches are always welcome (No one has taken me up on this yet. Would love to try it out.)
Enjoy and happy hacking!