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

PictureBox Control Zoom

Recently I needed to implement zooming functionality using the mouse wheel in PictureBox control in C#.

My initial reflex was to reuse existing free code, but I kept on running into controls that were either too bulky or badly implemented. In the end I implemented a relatively simple class which can be used with the standard C# PictureBox.

One of the nicer functionalities of this implementation is that the point being scrolled under the cursor will stay in place during zooming in/out.

The heart of this class is the following function:

Read more