Make a control from existing objects
If you have an idea for the design of a control, and you cannot use one of the system controls that come with Microsoft Expression Blend 2, you can create your control on the artboard by drawing the components of your control, and then converting those components to a reusable user control (also named a UserControl).
To make a control from existing objects on the artboard
Click the Selection tool. Hold the SHIFT key when you select both of your rectangles.
Right-click the selected objects, click Group into, and then select the Canvas panel from the pop-up menu. The rectangles become child objects of a new layout panel.
You can select and right-click objects either on the artboard or under Objects and Timeline (as in the following image).
There are many different types of layout panels, each with a different layout scheme. In a Canvas panel, the child objects will not resize with your application window. In a Grid panel, you can configure child objects to autosize and set the alignment and margin properties under Layout in the Properties panel to let the child objects resize with your application window.
Right-click the new canvas object under Objects and Timeline, and then select Make Control from the pop-up menu.
The Make Control dialog box appears.
You can leave the fields as they are and click OK.
A new user control is created, opened for editing, and visible in the Project tab.
Build your application (CTRL+SHIFT+B). This will save your files, let the user control be displayed in the main document, and make it available from the Custom Controls tab of the Asset Library so that you can use it again.
You can also make a button from existing objects. This gives you a new button template instead of a new user control. For more information, see Make an object into a button.
As an alternative to a user control that inherits from the UserControl class, you can create a custom control that inherits from the Control class or from the system controls that come with Expression Blend 2 (because they also inherit from Control). Such custom controls are compiled into DLL files that you can reference in your project so that you can draw the custom controls on the artboard. Controls that inherit from the Control class can use templates, just like the system controls. For more information, see Try it: Create a custom WPF control and Create or edit a control template.