WPF control-itemscontrol

Source: Internet
Author: User

1. Is itemscontrol a control?

Itemscontrol can be directly used in panel

 
<Stackpanel> <ItemscontrolName= "Items"> </Itemscontrol> </Stackpanel>

Setting itemssource directly can also be displayed:

 
Items. itemssource =NewList<String> {"","B","C"};

It indicates that itemscontrol is the same as a common control.

2. Features of The itemscontrol Control

Itemscontrol is a control that can contain multiple projects. You can set itemssource or items to specify the content of itemscontrol.

Itemssource:

Itemssource can be any type that implements ienumerable, such as arraylist, hashtable, queue, list, etc.

Items:

You can use the items. Add method to manually add the itemscontrol subitem. Various types are supported, such:

 
Items. Items. Add (Datetime. Now); items. Items. Add ("String");EllipseEllipse =NewEllipse(); Ellipse. width = 40; ellipse. Height = 40; ellipse. Fill =Brushes. Blue; items. Items. Add (ellipse );

The displayed result is as follows:

Relationship between itemssource and items:

After itemssource is set, the items attribute isRead-OnlyAnd has a fixed size.

If you want to resume using items, you can set itemssource to null. In this case, items will be an empty itemcollection.

3. Which controls inherit the itemscontrol

Include the following controls:

Selector: combox, ListBox, tabcontrol, multiselector

Headerditemscontrol: menuitem, toolbar, treeviewitem

Menubase: contextmenu, menu

Treeview

Statusbar

Datagridcellspresenter

Datagridcolumnheaderpresenter

 

Celery label: WPF

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.