C #-dev xtratabcontrol: dynamically add and disable tabs

Source: Internet
Author: User
Tags xpage

C #-dev xtratabcontrol dynamically adds the tab and closes the tab method. For more information, see.

 

Record it to avoid forgetting it later

Add using devexpress. xtratab;

Double-click listview to add the corresponding tabpage. Do not Add the following items again:

 

Private void listview_index_mousedoubleclick (Object sender, mouseeventargs e) {If (latency> 0) {listviewitem LVI = listview_index.selecteditems [0]; // obtain the selected string name = LVI. text; // determine whether foreach (xtratabpage in xtratabcontrol) has been created. tabpages) {If (page. TEXT = Name) {xtratabcontrol. selectedtabpage = page; // display the return;} // Add tabpage xtratabpage xpage = new xtratabpage (); xpage. name = Name; xpage. TEXT = Name; xpage. controls. add (listview_tec); // Add the control xtratabcontrol to be added. tabpages. add (xpage); xtratabcontrol. selectedtabpage = xpage; // display this page }}



 

 

To display the close button on the tabpage, set the closepagebuttonshowmode attribute of xtratabcontrol to inalltabpageheaders. If you want to display the close button on the home page:

 

Xtratab_index.showclosebutton = devexpress. utils. defaultboolean. False; // The close button is not displayed on the homepage.

 

Add the closebuttonclick event of xtratabcontrol:

 

Private void xtratabcontrol_closebuttonclick (Object sender, eventargs e) // close the tab method {devexpress. xtratab. viewinfo. closepagebuttoneventargs earg = (devexpress. xtratab. viewinfo. closepagebuttoneventargs) E; string name = earg. page. text; // obtain the text foreach (xtratabpage in xtratabcontrol) of the closed tab. tabpages) // retrieve the text {If (page. TEXT = Name) {xtratabcontrol. tabpages. remove (PAGE); page. dispose (); Return ;}}}

 

C #-dev xtratabcontrol: dynamically add and disable tabs

Related Article

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.