WPF control structure



Detailed explanation of various control types

  • ContentControl class

    Set the property of the Content to Content, for example



    Set Content only once in the control directory. Add an Image and a text Label to the button.



    Correct use:

  • HeaderedContentControl class

    In contrast to the ContentControl, this control sets the Content, as well as the Header with the title.

    Common grouping controls like GroupBox and TabControl child TabItem are controls with titles and content.



    Conent and Header can be set only once in the control directory. The following error occurs: Conent and Header can be set twice in the control directory.



    Correct use:

  • ItemsControl class

    Most of these controls belong to displaying list class data, and the way to set the data source is usually set through ItemSource. As follows:

  • Key commonly used control introduction:

    TextBlock: Static text used to display text that cannot be edited. Text Sets the content of the Text to be displayed.



    TextBox: a control used to input/edit content. Similar to TextBox in WinForm, Text sets the input to be displayed.



    Button: simple Button, Content display text, Click can set Click events, Command can set background binding commands



    ComboBox: dropdown box control, ItemSource sets the data source for the dropdown list, and can also display Settings, as shown below