January 12 was my last update to the bag-o-tricks. I couldn’t let two months go by without another refresh. There is a lot of stuff here I've already talked about. The code has been available via SVN for a while, but not in the convenient package.
The Goods
Binaries and Source [zip, 4.17MB]. Tested with Visual C# Express 2008.
The Details
- VS Copy-to-HTML - New!
- Blogged about it here.
- NotifyWorker - New!
- Blogged about it here.
- HueConverter - New!
- Makes it easy to create a pretty spectrum of colors for a number of items
- Animating Tile Panel
- Renamed AnimateNewItem property to AnimatesNewItem
- Made initial load not animate new items
- Polished the demo code
- CompositionTargetRenderingListener
- Added Dispose and used it where appropriate
- Added WireParentLoadedUnloaded helper method
- DemoCollection
- Added Reset command
- Moved to library assembly
- Extentions
- Added SelectResursive (see last blog post), among others
- FlipTile3D
- Moved to WrapperElement<Viewport3D>
- FolderPicker
- Moved to new SelectRecursive implementation
- WPFUtil
- Added HSB-RGB converter
- Created ‘Animate’ methods to abstract physics model. Moved FileTile3D, AnimatingTilePanel, and ZapDecorator to these.
- ZapScroller
- A lot cleaner. Removed a completely unnecessary layer of complexity.
- Added the ability to template the buttons. Thanks for the suggestion, Atul.
- WPF Set
- New in 3D! See blog post.
- General
- A bunch of renaming of namespaces. Most of the new stuff will exist under J832.Wpf
As always, the SVN location has been updated. Patches are always welcome. (I've had one taker on this. Very cool to do an apply patch. Would love to do it again.)
Enjoy and happy hacking!


9 comments:
This is great.
How much work would it be to tweak this to make it work in Silverlight?
hi,kevin ,Bag-o-Triks a good sample and application free source for learning wpf,i hvae a question than you i don't have e-mail than you i create blog in blogspot and i want writing colorizer code in a comment , i write code in my blog like http://work.j832.com/2008/02/xaml-serialization-with-wcf.html thank you alot
Hi Kevin,
Thanks for your helpful library!
I just used the Reveal component and found a small issue regarding the sizing of the content.
The code omits the horizontal and vertical alignment rules when they're set to stretch mode.
I did this minor change inside Reveal.cs and it works fine:
protected override Size ArrangeOverride(Size finalSize)
{
UIElement child = Child;
if (child != null)
{
double percent = AnimationProgress;
HorizontalRevealMode horizontalReveal = HorizontalReveal;
VerticalRevealMode verticalReveal = VerticalReveal;
double childWidth = child.DesiredSize.Width;
double childHeight = child.DesiredSize.Height;
if(HorizontalAlignment == HorizontalAlignment.Stretch && childWidth < finalSize.Width)
childWidth = finalSize.Width;
if(VerticalAlignment == VerticalAlignment.Stretch && childHeight < finalSize.Height)
childHeight = finalSize.Height;
double x = CalculateLeft(childWidth, percent, horizontalReveal);
double y = CalculateTop(childHeight, percent, verticalReveal);
child.Arrange(new Rect(x, y, childWidth, childHeight));
childWidth = child.RenderSize.Width;
childHeight = child.RenderSize.Height;
double width = CalculateWidth(childWidth, percent, horizontalReveal);
double height = CalculateHeight(childHeight, percent, verticalReveal);
return new Size(width, height);
}
return new Size();
}
Hi Kevin,
Can you explain why you chose to define WrapperElement<T> instead of simply inheriting from Decorator? They seem to be doing the same thing.
Cheers,
Yuval
Hi there,
Great stuff!!!
Regards
C# Disciple
I'm using the DatePicker, I really appreciate the work. When I set the value of DatePicker in my code, I'm no longer able to change the date through the datePicker dialog. Even when I set the readOnly property to false and the canEdit property to true, it still won't let me update the date. Is there anything that I'm missing.
endDate.Value = DateTime.Now;
endDate.CanEdit = true;
endDate.IsReadOnly = false;
Thanks!
Brandon Petersen
Hello,
I have the same problem as Brandom.
Also, could you explain in your blog how to change the string date format for other locales than English?
Thanks
I wish I could provide a solution, but it seemed to start to work without any problems. Not sure what changed for it to start to work.
Brandon
Brandon,
I've spent over an hour on this. It's because the datetime you're binding to has a Time element (perhaps DateTime.Now ?) Use DateTime.Now.Date instead. It's a bit of a bug in the calendar control in Unselect() (MonthCalendar.cs).
Additionally, I added the following to the constructor to work around the text formatting.
Language = System.Windows.Markup.XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name);
Good control, thanks.
Post a Comment