When you first create a custom control in a project, Visual Studio creates a folder named Themes, and places a file named Generic.xaml. This file contains all the styles and templates of the custom controls, by default. When you add more custom controls inside the same project, the Generic.xaml file gets updated with the styles of the new controls.
The property called TargetType defines the type of the control for which we are going to create the style. In the preceding example, <Style TargetType="{x:Type local:SearchControl}"> defines the style of the custom control called SearchControl. To change the UI of the control, we need to update the same style.
The <ControlTemplate TargetType="{x:Type local:SearchControl}"> defines the template of the control, which generally resides inside the Style.
The Setter properties inside the Style define the default value of various properties of the said control. In the preceding example, we have defined...