How to create your item in visual stidio?

When working with projects like wpf, is given a lot of freedom to create the interface. Quite often, Nay always, the interface consists of similar elements like: button, TextBox, picture. But sometimes there is a need for frequent use of more complex structures, which is extremely cumbersome. For example, the analogue of list cheackbox's, or sticking slider button. Is it possible to create a feature that will be called more compact code?
September 26th 19 at 07:26
1 answer
September 26th 19 at 07:28
For this you can create a UserControl or CustomControl.
In the first case, you create a UserControl (user control) by adding it to the project as window application. Set up essentially as part of the application window, adding the necessary controls on it and describing logic in the code. After project is compiled, the control will automatically be placed on the toolbar.
For example:
<usercontrol x:class="WpfApplication3.UserControl1" xmlns="" xmlns:x="" xmlns:mc="" xmlns:d="" mc:ignorable="d" d:designheight="300" d:designwidth="300">
 <listbox grid.row="1">

In the second case, you would inherit from the base control and add to the theme of the design and some logic. Menu items are added this type is called a CustomControl or a custom control.
Or through C#:
public MyTextBox : TextBox


Either via Xaml:
<textbox x:class="WpfApplication1.MyTextBox" xmlns="" xmlns:x="" xmlns:mc="" xmlns:d="" mc:ignorable="d">


Find more questions by tags User interfaceVisual StudioWPF