Adding a parameter to a WPF control style

In this post I will demonstrate how to add a new parameter to a WPF control style without overriding the control parent class.

In particular I have created a custom button style that relies on the CornerRadius parameter to round any of the four corners of the button. Using this button style I have created a sample keypad shown below:

Read more

Thread Safe Event Dispatching in WPF

Recently I have been using a quite a bit of C# WPF on the projects I am developing because it provides for very flexible and quick user interface design and implementation. The learning curve for a traditional (C/C++) software developer may be steep, but once the basics are understood it is pretty easy to use as a development tool.

Since I develop applications that use external hardware (ex. Camera) I have to place some of the logic in threads in order not to block the user interface while an action is performed. After the action completes I need to pass the message back to the user interface. Unfortunately WPF user interface breaks if a user interface event is instantiated from a thread. Because of this I have created a class extender for EventHandler that makes thread instantiated events possible.

Read more