Skip to content

DevExpress-Examples/winforms-bars-create-baredititem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Bars - Create and customize bar edit items at runtime

This example creates two bar edit items (combobox and progress bar) and places them on top and status bars.

![WinForms Bars - Create and customize bar edit items at runtime(https://raw.githubusercontent.com/DevExpress-Examples/how-to-create-a-baredititem-at-runtime-e708/13.1.4%2B/media/winforms-bars-edit-items.png)

private void Form1_Load(object sender, System.EventArgs e) {
    DevExpress.XtraBars.BarEditItem item;
    DevExpress.XtraEditors.Repository.RepositoryItemComboBox combo;
    DevExpress.XtraEditors.Repository.RepositoryItemProgressBar progress;

    barManager1.ForceInitialize();

    combo = barManager1.RepositoryItems.Add("ComboBoxEdit") as DevExpress.XtraEditors.Repository.RepositoryItemComboBox;
    combo.Items.Add("Item A");
    combo.Items.Add("Item B");
    item = new DevExpress.XtraBars.BarEditItem(barManager1);
    item.Edit = combo;
    item.EditValue = "[n/a]";
    item.Width = 100;
    barStandard.AddItem(item);

    progress = barManager1.RepositoryItems.Add("ProgressBarControl") as DevExpress.XtraEditors.Repository.RepositoryItemProgressBar;
    item = new DevExpress.XtraBars.BarEditItem(barManager1);
    item.Edit = progress;
    item.EditValue = 26; // 26%
    item.Width = 150;
    barStatus.AddItem(item);
}

Files to Review

Documentation

See Also