WPF controls introduction and notes (2)

The last chapter talked about the layout, this is a bit similar to the architectural design, the first step is to the drawings, the overall structure, and the second step is piling up, there will be a lot of architecture is described, for example, bricks, cement, glass, porcelain board. In WPF, which is the basis of all the controls, UI controls for filling structure.

WPF control structure

Various controls Type In Depth

  • ContentControl Class

    Set the content property to Content, for example,

    Under the control directory allows only one Content, following a presentation to the Image button to add a text display and Label, the following error:

    Correct use:
    <! Say the last chapter we talked about using the layout in which the container is loaded, you can avoid this situation>

  • HeaderedContentControl 类

    ContentControl is relative, these controls can be set Content, as well as Header with a title.
    Like the more common packet control GroupBox, TabControl a child element TabItem, they all have the title and content controls.

    Similarly, under the control of such directory allows only one Conent and Header, as shown in the following error appears twice set the Header and Content error:

    Correct use:

  • ItemsControl class

    Such control data belonging to the display list of most classes, the data source provided by way of general ItemSource setting. As follows:

  • Key common controls introduced:

    TextBlock: used to display text, static text editing is not allowed. Text settings display text.

    TextBox: control for inputting / editing content, the TextBox winform with similar effect, Text Content inputted display.

    Button: Simple button, Content display text, Click can set the click event, Command can set the background of bind command

    ComboBox: drop-down box control, set the drop-down list of the ItemSource data sources, the display may be provided, as follows

Guess you like

Origin www.cnblogs.com/zh7791/p/11372473.html