|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article

Introduction
Welcome to WPF.JoshSmith. This is not a typical CodeProject article. I am using the Web page generated for this article to host, and make publicly available, a library of classes I have created for use in Windows Presentation Foundation applications. Over time I will update this page (and the source code download) to include any new classes I've added to the WPF.JoshSmith library. Think of this as a really cheap and easy alternative to creating a full Web site just to make the assembly available to the world.
All of the major classes in WPF.JoshSmith either have an article about them here on the CodeProject, or I've blogged about them. The purpose of WPF.JoshSmith is to consolidate all of the classes I've created into one place, thus making it easier for people to have all the goodies in one assembly. In addition to providing the WPF.JoshSmith assembly, the source code download at the top of this article also contains test/demo projects for many of the various classes in the library. Those projects show how to use the code and what the various classes do.
All of the code in the library can be used free of charge, provided that the copyright statements in each source file remain intact. Josh Smith accepts no responsibility for any errors, loss of data, system crashes, etc. that occur as a result of using WPF.JoshSmith.
Contents
This section provides an overview of the major classes available in the library, divided up by namespaces. Click on the name of a class to open an article/blog entry which discusses it in depth.
- WPF.JoshSmith
- Adorners
- DragAdorner - A lightweight adorner which renders a visual that can follow the mouse cursor, such as during a drag-and-drop operation. Original concept taken from this blog post.
- UIElementAdorner - An adorner which can display one and only one
UIElement. The element is added to the adorner's visual and logical trees, enabling it to particpate in dependency property value inheritance, amongst other things.
- Controls
- Validation
- RegexValidationRule - A
ValidationRule-derived class which supports the use of regular expressions for validation.
- RegexValidator - A static class which provides attached properties that supply validation of the text in a
TextBox, using regular expressions. This class works in conjunction with the RegexValidationRule.
- CenteredContentControl - A
ContentControl derivative which exposes read-only dependency properties that return the element's center point (CenterX and CenterY). Those values can be used to bind another element (such as a Line) to the center of the CenteredContentControl, even if it is relocated at runtime.
- RoutedDataTemplateSelector - A DataTemplateSelector that bubbles a routed event when asked for a template, allowing an element in the visual tree to decide what template to use.
- SlidingListBox - A
ListBox which provides an animated slide effect when ListBoxItems are selected.
- SmartTextBox - A
TextBox with support for displaying a list of suggestions when the user misspells a word. The user presses the F1 key to display the list of suggestions.
- Data
- ValueConverters
- EnumValueToDescriptionConverter - An
IValueConverter which supports conversion from an enum value to the description of that value. If the enum value is decorated with the DescriptionAttribute attribute, its Description value is returned. Otherwise, the name of the enum value is returned.
- ResourceKeyToResourceConverter - A converter that performs a resource lookup, using the conversion value as a resource key.
- ValueConverterGroup - An
IValueConverter which contains a list of IValueConverters and invokes their Convert or ConvertBack methods in the order that they exist in the list. This allows for modular value converters to be "piped" together to achieve complex conversions.
- XamlToObjectConverter - An
IValueConverter which creates a .NET object from the XAML contained in an XmlElement. The object created can be used as the content of a WPF control or ui element, such as the ContentPresenter. The inner XML of the XmlElement passed to the converter must contain valid XAML.
- DataContextSpy - Exports an element tree's DataContext to objects external to the tree itself.
- Input
- CommandGroup - A command that aggregates other commands into a group and operates on them as an atomic unit.
- SmartRoutedCommand - A RoutedCommand which allows its subclasses to provide default logic for determining if they can execute and how to execute.
- Markup
- IfFullTrustExtension - This markup extension conditionally instantiates the XAML you pass it if and only if the application is running in full-trust.
- Panels
- DragCanvas - A
Canvas which manages dragging of the UIElements it contains.
- Panel3D - A panel that lays its children out in 3D space and provides animated movement of the children.
- ServiceProviders
- UI
- ListViewDragDropManager - Manages the dragging and dropping of
ListViewItems in a ListView.
- ListViewItemDragState - Exposes attached properties used in conjunction with the
ListViewDragDropManager class. Those properties can be used to allow triggers to modify the appearance of ListViewItems in a ListView during a drag-drop operation.
- UnloadedManager - A service provider class which provides a means of releasing resources when a
FrameworkElement's Unloaded event fires. If the DataContext of the element implements IUnloadable, it's Unload method will be invoked when the elements Unloaded event fires.
Revision History
| Date |
Assembly Version |
Notes |
| November 11, 2006 |
1.0.0.0 |
Created the article.
|
| November 28, 2006 |
1.0.0.1 |
Added the CenteredContentControl and updated the source code download.
|
| January 24, 2007 |
1.0.0.2 |
Added the ListViewDragDropManager, ListViewItemDragState, and DragAdorner classes. Also fixed broken links to articles that were moved. Updated the source code download.
|
| February 1, 2007 |
1.0.0.3 |
Fixed a couple of bugs in the ListViewDragDropManager (see the article for details). Updated the source code download.
|
| February 25, 2007 |
1.0.0.4 |
Added the SmartTextBox control, and the UIElementAdorner. Refactored the DragAdorner and UIElementAdorner so that they share a base class. Used a bug fix created by William J. Roberts in the MouseUtilities class (read here for more details). Updated the source code download.
|
| April 13, 2007 |
1.0.0.5 |
Fixed a minor bug in the ListViewDragDropManager, which is described in detail at the bottom of that class's article. Updated the source code download.
|
| July 13, 2008 |
2.0.0.0 |
Added many classes to the library and fixed the many links that broke over time. |
| You must Sign In to use this message board. |
|
| | Msgs 1 to 25 of 52 (Total in Forum: 52) (Refresh) | FirstPrevNext |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
Josh... excellent as always. I'm just starting in WPF (of course I couldn't start with just "Hello World", I had to start with a full blown lookless (ahem... sort of) custom control - good thing I keep my hair short) and your various articles have helped a lot. I can already see a few things in this library that will help with what I'm doing next. And we'll also be using the Infragistics WPF controls. Thanks, and keep up the good work!
My neglected blog: http://www.michelrenaud.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
Works fine here... (Downloaded latest update, July 13, 2008)
My neglected blog: http://www.michelrenaud.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
ArchCodeAngel wrote: Doesn't load into VS 2008, gives a project type not supported... nor does it try to convert it.
If you are still having that problem, I suggest you download the latest copy. I just updated WPF.JoshSmith today, and converted the solution to VS2008 in the process.
:josh: My WPF Blog[ ^] All of life is just a big rambling blog post.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Hey Josh,
Just noticed - a few of your links here point to your old blog, now 404'd. I wanted to go look at that enum converter article and got a 404!
Just thought I'd mention it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks Patrick. My former employer deleted my blog when I left . I've been meaning to update this article with links to new versions of the blog posts, but some of them are lost forever. Eventually I'll figure out what to do about this...
:josh: My WPF Blog[ ^] Without a strive for perfection I would be terribly bored.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
No problem Josh. Turned out what I needed to do was simpler than I thought. Good luck figuring out what to do about those blog posts
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Hi Josh, I'm new on WPF Recently I made a decision to develope an application which involves 3D visualization. I want to know is it easy to use 3D capability of WPF rather than using Direct3D? You know, I want to create some simple 3D shape taking advantage of light and camera.
Thank you in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Majid Shahabfar wrote: Recently I made a decision to develope an application which involves 3D visualization. I want to know is it easy to use 3D capability of WPF rather than using Direct3D?
I don't know, I've never used Direct3D or done any serious WPF 3D programming.
:josh: My WPF Blog[ ^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi Josh
I'm still big on a Wpf.JoshSmith.BreadCrumb[^] control. That would rock.
I've got another idea for the Wpf.JoshSmith library: Wpf.JoshSmith.TaskDialog[^].
Built with WPF, we could make one that works on XP as well as Vista, whereas the Vista TaskDialog common control works only on Vista.
What do you think? Seems like it wouldn't be too difficult to build such a dialog.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Judah Himango wrote: Seems like it wouldn't be too difficult to build such a dialog.
Thanks for the suggestion. Difficulty is not necessarily a prohibitive factor, time is. I'm interested in the BreadCrumb control idea that you posted a while ago, it just hasn't made it to the top of my todo list yet.
:josh: My WPF Blog[ ^] Enjoy! Vote! Learn! Love! Save the whales! Eat raw diamonds! Do the Foxtrot in your tighty-whiteys! Start fires! Kill Martians!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I just need to learn to write WPF stuff; I could then write the damn thing myself instead of complaining to WPF god Josh Smith. 
I've tinkered with WPF a bit...I was able to modify the WPF RichTextBox to automatically underline hyperlinks. I've played with some of the various WPF document classes as well, but that's the extent of my experience.
One thing that is discouraging me from learning WPF further is the tools. I'm using Cider to play with WPF in VS, and jeez, Cider is hardly alpha quality. Makes me run back to the functional WinForms designer. 
By the way, Josh, how are you cooking up your XAML? Is that done with Cider? By hand?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Judah Himango wrote: By the way, Josh, how are you cooking up your XAML? Is that done with Cider? By hand?
I do almost all of my XAML writing by hand. The only thing that I've used Blend for is creating intricate Path objects, the kind of stuff that typing by hand would be impractical. I like hand-coding my XAML because it promotes learning and exploration.
:josh: My WPF Blog[ ^] Enjoy! Vote! Learn! Love! Save the whales! Eat raw diamonds! Do the Foxtrot in your tighty-whiteys! Start fires! Kill Martians!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Ok Josh, since you seem to be the resident WPF expert and I've just last night installed .NET 3.0, Expression Blend, and the Cider addin for VS2005..
Where do you recommend I go to start learning about all this? I tried making even a very simple app using these new tools and failed miserably - the development architecture and paradigms are just too different from .NET 2.0 (now, mind you, I've been programming in .NET for quite some time so I'm very familiar with the technology).
Maybe I'm just feeling a bit overwhelmed because it's all so new..
For example, I look at this example: Creating the Glass Button[^]
And I wonder how anyone could have even begun such a project. Nothing in that button uses the visual designer, it apparently is all Expression Blend.
Anyway, I ramble, but good tutorials on the technology (and that reveal how powerful XAML apparently really is - it looks like the designer is just an afterthought, now) would be wonderful...
|
| Sign In·View Thread·PermaLink | 4.00/5 (2 votes) |
|
|
|
 |
|
|
Patrick Sears wrote: Where do you recommend I go to start learning about all this?
That's a really tough question. WPF is huge, huge, huge. What do you want to be able to do with WPF? Make line-of-business apps? Make 3D visualizations of molecular structures? Create an animated board game with skinnable pieces and slick visual effects? Build a high-fidelity document viewing application? All of the above? None of the above?
Based on what you are looking to create, I would suggest different sources of learning material.
I realize that so far my answer has not answered anything, so let me take a step back and give some general tips and links...
NetFx3[^] is a great place to see all kinds of projects, article links, blogs, etc about .NET 3.0 (including WPF).
NetFxGuide[^] is really good too.
A while back I blogged about how to get started with WPF. Check it here[^].
I've posted quite a few WPF articles here on CP: Clickety[^].
Lastly, I highly suggest reading Adam Nathan's book 'WPF Unleashed.' Here's why...[^]
HTH
:josh: My WPF Blog[ ^] Don't you wish your girlfriend was hot like me?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Josh Smith wrote: WPF is huge, huge, huge.
Boy, you ain't kidding.
Josh Smith wrote: What do you want to be able to do with WPF?
Well, at the moment my attention is drawn most to the custom templating you're apparently able to do with the controls. Your custom TreeView was quite impressive, the ListView drag drop manager, and the sliding list box.. all quite impressive. So I think for the moment, what I'm looking for is 'skinnable and slick visual effects.' Shallow, I know, but I develop user apps and that's all users care about.. hehe.
Thanks for the 'clicketies'. I'll be buried in them for awhile..
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Question:
In your intro to WPF, you state:[^]
"Another benefit of using vector graphics is it works well with high-resolution displays; something which is becoming a problem for the antiquated HWND technology as the resolution of display units improves."
I read something to the same effect on another blog, basically that WPF is not HWND based. What is the basis for this statement? Windows (Vista included) itself is still HWND based, is it not? How can the operating system fundamentally render a window without an HWND?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
General News Question Answer Joke Rant Admin
|