Getting Started with WPF "Common controls"

Source: Internet
Author: User

1.GroupBox

Note: GroupBox still needs layout containers to place elements. such as: StackPanel panel

<groupbox header= "select number?" >        <StackPanel>            <RadioButton>one</RadioButton>            <radiobutton>two</ radiobutton>            <RadioButton>three</RadioButton>        </StackPanel>    </groupbox >

2.TabControl

Like this tab control, in the WinForm species is very common, tabpge sub-pages, whereas in the WPF species, the corresponding is the TabItem class.

The code shown:

<TabControl>        <tabitem header= "Home" >            <StackPanel>                <button>button1</button >                <Button>button2</Button>                <Button>button3</Button>            </StackPanel>        </TabItem>        <tabitem header= "second page" >            <StackPanel>                <button>button4</ button>                <Button>button5</Button>                <Button>button6</Button>            </ stackpanel>        </TabItem>            </TabControl>

As with the Content property, the Header of TabItem can also receive objects of any type. This means that you can create a combo box or tab. Include arbitrary shapes and arbitrary elements in their page titles. is as follows:

<TabControl>        <tabitem >            <TabItem.Header>                <stackpanel orientation= " Horizontal ">                    <button background=" Transparent "borderbrush=" Transparent ">?</Button>                    <textbox borderbrush= "Transparent" > Home </TextBox>                </StackPanel>            </ tabitem.header>            <StackPanel>                <Button>button1</Button>                <Button> button2</button>                <Button>button3</Button>            </StackPanel>        </tabitem >    </TabControl>

3.Expander Menu Control

Content shrink controls with headers, which are common in the web, are used on the left menu.

The code looks like this:

    <StackPanel>        <expander header= "One" margin= "5" padding= "5" >            <textblock textwrapping= "Wrap" >ofo have been favored by the public, even the foreign people speak highly of it. These yellow                bikes can is found everywhere, so the people who is in a hurry can use it and then                 reached the Desti Nation in time.</textblock>        </Expander>        <expander header= "5" margin= "5" >            <textblock textwrapping= "Wrap" >especially for the visitors, they can ride these bikes and then has a look at t He scenery around.</textblock>        </Expander>        <expander header= "three" margin= "5" padding= "5" >            <textblock textwrapping= "Wrap" >it can saves them a lot of money and the most important thing are the Conven Ience it brings.</textblock>        </Expander>    </StackPanel>

  

4.ListBox controls

the ListBox control is a very flexible control that contains not only child elements ListBoxItem objects.    You can also host other elements, which means that the ListBoxItem class inherits from the ContentControl class, so that ListBoxItem can contain a nested piece of content.

For example, create a list that contains a normal button. As shown below:

<StackPanel>        <ListBox>            <ListBoxItem>                <button> button1</button>            </ListBoxItem>        </ListBox>        <ListBox>            <ListBoxItem>                <button>? button2</button>            </ListBoxItem>        </ListBox>        <ListBox>            <listboxitem >                <button> button3</button>            </ListBoxItem>        </ListBox>    </ Stackpanel>

5. ProgressBar progress bar

The Isindeterminate property is set to true, and the control periodically displays a green (default) left-to-right pulse.

    <Grid>        <progressbar isindeterminate= "True" height= "+" ></ProgressBar>    </Grid>

Of course, we can also modify the color of its scrolling by modifying the foreground property. As shown below

    <StackPanel>        <progressbar margin= "2" isindeterminate= "True" height= "" foreground= "Green" ></ progressbar>        <progressbar margin= "2" isindeterminate= "True" height= "+" foreground= "Red" ></ progressbar>        <progressbar margin= "2" isindeterminate= "True" height= "" foreground= "Chocolate" ></ progressbar>        <progressbar margin= "2" isindeterminate= "True" height= "" foreground= "DarkSalmon" ></ progressbar>        <progressbar margin= "2" isindeterminate= "True" height= "" foreground= "Pink" ></ progressbar>        <progressbar margin= "2" isindeterminate= "True" height= "" foreground= "DodgerBlue" ></ Progressbar>    </StackPanel>

  

  

Getting Started with WPF "Common controls"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.