In a windows form, I want to replace all this forms' buttons with a custom button, CustomNamespace.controls.customButton
, which as you guess, extends the Button class from system.windows.controls.button
.
Currently, the only proper way I can think of doing it is deleting the original button, adding in the customized one and manually changing the properties one-by-one. However, this becomes a hassle when you need to replace more than one button with different properties or events.
Another way that I can think of doing while keeping its properties intact is replacing ... = new system.windows.controls.button()
to ... = new CustomNamespace.controls.customButton()
in the .designer.cs
file. As much as possible, I would prefer not to go that way unless there are no other better solutions.