if you come from the WinForms age you might know the SendKeys class and the SendKeys.Send method, which allows you to send keys to the keyboard.
Meaning that you can simulate the pressing of a key.

But in WPF this class is no longer present. Instead of this class you can use the InputManager and feed it with the KeyEventArgs which will then be processed.
I created a small class which simplyfies this process.

if you ever missed the IsSynchronizedWithCurrentItem property in one of your controls you might need this.
Well basically you can enable a feature using this property which is synchronizing the selected item of your Control (ListBox, ComboBox, etc.) with the current item of the collection to which you bind to.

In my case I needed this feature in the Telerik RadListBox. Therefore I created an attached property which simulates this feature.
Basically what I’m doing is the following:

When the SelectedItem in the ListBox was changed => update the CurrentItem in the Collection

When the CurrentItem in the Collection was changed => update the SelectedItem of the ListBox

The tricky part here is that the user might bind a new collection to the control. Such that you have to notice that the collection was changed and register the events for the new collection.
Therefore I used this ListBoxSources-Dictionary which contains the key value pairs of the listboxes and their corresponding collections.
If the collection is different from the one it has before we know that it was changed and have to unregister the events in the old collection and register then in the new collection.

Maybe you wanted to bind a command to the MouseDown Event of the Button.
But there is just the Command for the Click Event. Therefore it is necessary to do a little bit of coding.

I usually need the MouseDown / MouseUp Events of the Button for several use cases.
Therefore I just created a simple behavior which contains two command properties (on for the MouseUp and one for the MouseDown event).

Today I had a strange problem when I wanted to define a DataTemplate of a specific type which is located in the same assembly as I wanted to use it.
The problem was that if I wrote the assembly-name in the import of the Namespace then I got the following Exception:

The type reference cannot find a public type named ‘MyType’

So after a few hours of testing and searching I finally found the solution. I just had to remove the assembly from the import of the namespace.

If you are programming applications which should be used on a touch screen then you may have encountered the problem that it is tricky to use the scrollbar with the finger.
Because the default scrollbar is to small.

If you want to adjust the width of all scrollbars in your application you can put this piece of code into you resources

All right. Here you see this simple ValidationRule with our additional property (Length).
We can not use DependencyProperties because ValidationRule does not extend DependencyObject therefore we have to use this property.

You may think that it works like this but it does not. Since the Length property is not a DependencyProperty we can not directly bind to it.
But there exists a nice workaround. We can just use a so-called proxy which allows us to bind values to normal properties.
I used the proxy from this blog: http://www.11011.net/wpf-binding-properties

I attached the demo project. Where you can specify the maximal length (upper TextBox) of the string in the TextBox at the bottom.
Note that the Validation will only be updated when the value of the TextBox was changed!

The attached file is a rar file. I just have to add the doc extension because else I can not upload it.
Change the extension in .rar then you can extract it. (It contains the demo project as a VS 2010 Beta solution)ValidatorWithParameter.rar (doc)