Extending with Code Behind
The Designer supports Visual Basic and C# for code behind.
The Designer automatically creates a name for control objects when they are added to the design surface. Objects that are on the design surface that are containers are often not named by the Designer. You can name an unnamed object or change the name of an existing object in the Properties panel.
If you want to access an object on the design surface from your .NET code behind, you must reference it using its name. For example, if you have a button named ‘Button1’ on the design surface, you could access it programmatically with the following code:
Button1.Background = Brushes.Red;