Ultragrid Infrastructure - Combobox as a column

I have a problem managing UltraGrid from Infragistics. I created an ultra combination with several values ​​in it:

UltraCombo ultraComboPaneel = new UltraCombo(); ultraComboPaneel.DataSource = articleList; ultraComboPaneel.ValueMember = "ArticleID"; ultraComboPaneel.DisplayMember = "Name"; 

Now I have UltraGrid and I want to put ultraCombo in the cell so that I can select one of the ultcombo elements as the cell value. I tried this both in code and in an ultra-gradient designer, but I cannot find a way to do this.

Have any of you got an idea? Additional information may be provided if necessary.

Edit:

I found something like

 UltraGridColumn ugc = ultraGridTypePaneel.DisplayLayout.Bands[0].Columns.Add("combo"); ultraGridTypePaneel.DisplayLayout.Bands[0].Columns["combo"].EditorControl = ultraComboPaneel; 

I feel like I'm on the right track, but it still doesn't appear on the screen ...

+4
source share
3 answers

UltraCombo has great functionality. If you only need to select an item from the list, you can find the ValueLists grid to provide the best solution.

Here is the code to get you started:

  private void myGrid_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { const string colorValueList = @"ColorValueList"; if (!e.Layout.ValueLists.Exists(colorValueList)) { ValueList svl = e.Layout.ValueLists.Add(colorValueList); svl.ValueListItems.Add(1, "Red"); svl.ValueListItems.Add(2, "Green"); svl.ValueListItems.Add(3, "Blue"); } e.Layout.Bands[0].Columns["Color"].ValueList = e.Layout.ValueLists[colorValueList]; } 
+3
source

You can find on the link below some approaches that you can use to place DropDown in an UltraGrid cell:

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841

Returning to your current code snippet - you are almost there:

First you need to set the binding context of your UltraCombo to the BindingContext of the form in which your UltraCombo will be used, for example:
ultraComboPaneel.BindingContext = this.BindingContext;

Note that setting a binging context must occur before your control is in ControlControl. Another thing I noticed is that the property is currently changing to EditorComponent, so I believe that you are using an older version of the Infragistics components. However, you should still use the same approach. I created a small piece of code that shows above with code:

 public partial class Form1 : Form { UltraCombo uc; public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Int", typeof(int)); dt.Rows.Add(1); dt.Rows.Add(1); dt.Rows.Add(1); DataTable dtt = new DataTable(); dtt.Columns.Add("Int", typeof(int)); dtt.Rows.Add(2); dtt.Rows.Add(2); dtt.Rows.Add(2); uc = new UltraCombo(); uc.BindingContext = this.BindingContext; uc.DataSource = dtt; ultraGrid1.DataSource = dt.DefaultView; } private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns[0].EditorComponent = uc; } } 

Hope this helps.

+3
source

Instead, I use Ultra Dropdown.

dim udd Like UltraDropDown

udd = New UltraDropDown

  With udd 'add data binding or value list items here End With Me.ultragrid.DisplayLayout.Bands(0).Columns("Column Name").ValueList = udd 

The key is the last line that assigns a “List of Values” to the Ultranet column for the Drop down control.

+1
source

All Articles