A WPF Problem Solved Two Very Different Ways – Using XAML Only – Using A Custom Control

October 28, 2007

I’ve just posted an article at The Code Project on WPF problem solving.  If you attened any of my recent presentations I strongly suggest you read this article and download this code.  The custom controls I gave out at the Charlotte Developers GUILD Fall Code Camp have been updated.

This article shows to VERY different approaches to solving problems in WPF.

There is a cool demo application with lots of examples and a special Halloween treat (Easter Egg).

Take a look at the article on Code Project :

Different Approaches To WPF Problem Solving

Just a grain of sand on the worlds beaches.


Upcoming WPF Presentation – Triangle .Net User Group, Raleigh, NC

October 24, 2007

Our Charlotte Developers GUILD Fall Code Camp was awesome.  Many outstanding speakers came from out of the Charlotte area to present.  Everyone learned much and had a great time.  Nothing like the family atmosphere here in Charlotte.

Mr. WFP, Josh Smith came from NY City and brought his WPF road show to us.  Thanks Josh for your teaching and the time we spent together, you are The Man.

Today Rob Zelt from Raleigh, NC invited me to speak at the Triangle .Net User Group on Wednesday, 14 Nov 2007.  The pizza is served at 5:00pm, the presentation should kick off at 6:00pm.  This is very encouraging to get another invitation.

The topic will be Authoring WPF Custom Controls.

I love speaking and talking with developers about WPF and the topic of .NET custom controls in general is one of my favorites.

I’m just about done with my Code Project article on WPF Custom Controls and hope to post it in a day or two.

Have a great day,

Karl

Just a grain of sand on the worlds beaches.


Taste The Power – Gets Another BOOST

October 18, 2007

I was thinking about the ListBoxWithIndicator custom control I wrote for the upcoming Charlotte Developers GUILD Code Camp and wanted to add the ability to use a CheckBox instead of a path to indicate that the ListBoxItem was selected. The result would be a WPF CheckListBox.

I tried several different approaches to add this functionality to the ListBoxWithIndicator custom control but, all were leading to developer hackery.  So I authored the CheckListBox as a separate control and added this control and a demo of the control to the Taste The Power presentation.  I’ll write a Code Project article soon explaining how the control works.

To me what is super cool, is that the ListBox knows nothing about the CheckBox that displays to the left of it. Yet, when you click on either the ListBoxItem or the associated CheckBox the ListBoxItem.IsSelected property changes.

Another awesome feature is, that if the ListBoxItem’s width causes the ListBox to display the horizontal scroll bar and the user scolls, the CheckBox does not scroll out of view.  This same feature is also part of the ListBoxWithIndicator custom control.

This control was inspired by Josh Smith and his awesome teaching and code provided the means for this control to be authored. You can view Josh’s article here.

Please check out the demo and see a true WPF CheckListBox.

You can download the updated Taste The Power Presentation below.

YOU MUST - after using the below link to download the file, you MUST change the extenstion to .zip. This is a requirement of WordPress.com.

Updated Taste The Power Presentation

I hope you like this code and can learn a lot from it.

Almost forgot, the code is all VB.NET!

Have a great day,

Karl

Just a grain of sand on the worlds beaches.


Charlotte, 20 Oct 2007 Code Camp Presentation Materials

October 17, 2007

Its time again for the Charlotte Developers GUILD Code Camp.  This Code Camp will be one for the books!

I’ll be doing two presentations at Code Camp, Taste The Power and a code walk through of a WPF business application.

You can download the Taste The Power Presentation below.  Instead of PowerPoint slides, the presentation is a WPF application that I’ll be using.

YOU MUST - after using the below link to download the file, you MUST change the extenstion to .zip. This is a requirement of WordPress.com.

Taste The Power Presentation

Taste The Power covers User Controls, Routed Events and Dependency Properties.

The application makes liberal use of UserControls demonstrating one method of structuring a WPF application by building the entire application with UserControls.

The RoutedEvent routing strategies are demonstrated visually and many RoutedEvents are implmented, some using custom RoutedEventHandler delegates.  Several UserControls demonstrate handling RoutedEvents at the class level as well as handling Attached Routed Events.  One UserControl also demonstrates how to handle a RoutedEvent even after its been marked as handled.  After the presentation and or studying this code, the developer will understand how RoutedEvents work and how to implement their own RoutedEvents. 

Included are two custom controls that teach how to declare and consume of Dependency Properties. 

Study the HyperLinkCustomControl control and see how easy it is to create and consume a control that does exactly what you want and need.  I wanted my Hyperlink to be able to display text or images and text, have some cool mouse over, mouse down behaviors and provide a ToolTip with the URL.  Actually, since HyperLinkCustomControl derives from ContentControl, the developer can stick just about anything inside the hyperlink.  It works very similar to an HTML hyperlink.  WPF does come with a Hyperlink control but it must be a child of either a Page, FlowDocument or TextBlock control.  Well, I needed one inside a UserControl so I wrote my own.

I’ll be writting a Code Project article on the included ListBoxSelectedItemIndicator custom control soon.  This control was inspired by Josh Smith and his awesome teaching and code provided the means for this control to be authored.  You can view Josh’s article here.  This control demonstrates how to listen in to what a child control is doing, attach events to the child and act upon those events, without the knowledge of the child control.  Take a look at the tab in the application entitled, “High Octane Custom Control.”  Before you dive into the code, think about how this can be accomplished.  I spent two days just thinking about this before I wrote this control.  Josh also showed me how to derive from ContentControl instead of Control which saved code and made the control better.  It was a lot of fun to write.

One of the UserControls is a password entry control.  The control measure the strength of the password as the user types it in and provides nice visual feedback.  This control demonstrates Dependency Property databinding. 

I hope you like this code and can learn a lot from it. 

Almost forgot, the code is all VB.NET! 

Have a great day,

Karl

Just a grain of sand on the worlds beaches.