Venu Boyalla

Venu Boyalla

  • NA
  • 19
  • 1.6k

WPF Forms : How to bulild Multiple Combo boxes dynamically

Aug 8 2019 9:07 AM
I have used the below code to achieve the requirement. But Only last comb box is displaying on the screen.
 
suppose i am trying to display 10 comboxes to display on the screen. But only 10th one is displaying on the screen
 
I am trying to add the combo boxes to canvas (ReportDropDown is my canvas name )
  1. for(int j =0; j < itemsCount; j++)  
  2. {  
  3.    ComboBox Itembox = new ComboBox();  
  4.    Itembox.Margin = new Thickness(10,10,0,13);  
  5.    Itembox.HorizontalAlignment = HorizontalAlignment.Left;  
  6.    Itembox.VerticalAlignment = VerticalAlignment.Top;  
  7.    Itembox.Width = 194;  
  8.    Itembox.Height = 30;  
  9.    Itembox.IsEditable = false;  
  10.    Itembox.Name = "ReportData" + j.ToString() ;  
  11.    ComboBoxItem cboxItem = new ComboBoxItem();  
  12.    cboxItem.Content = ActualColumnsList[j];  
  13.    Itembox.Items.Add(cboxItem);  
  14.    ReportDropDown.Children.Add(Itembox);  
  15. }  

Answers (5)