Tag Archives: attached properties

Thinking in WPF: more attached properties

In my last blog post, I wrote an article about attached properties. Today at work, I encountered a problem that can be solved in a nice way using an attached property. Because the functionality I wanted to implement is also very simple, I decided to blog about it to give a concrete example.

I wanted to use a TextBox to allow the user of my application to give a description for any item he selects in a TreeView. Because the TextBox’s content could be changed very frequently by the user, I thought it might be useful to select all the TextBox’s text when the user click in the control (so that as soon as he types something, the old content is cleared).

In this article, I will describe various way to implement this feature and I will detail the way I prefer, using of course an attached property !

Continue reading

Thinking in WPF: attached properties

Today, I decided to start a series that I’m calling “Thinking in WPF”. As you already know, I do NOT consider myself as a WPF specialist, so those blog posts don’t aim at giving a perfect knowledge of the “best” (if there are any) ways of thinking in WPF. I’d just like to share what I’m experiencing :-)

In my previous post, I started to write about things that I think makes WPF different. In the current project I’m working on at work, I had a good example of a new way of thinking with WPF. Todays article deals with a new WPF concept called Attached properties.

Continue reading