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 )
- for(int j =0; j < itemsCount; j++)
- {
- ComboBox Itembox = new ComboBox();
- Itembox.Margin = new Thickness(10,10,0,13);
- Itembox.HorizontalAlignment = HorizontalAlignment.Left;
- Itembox.VerticalAlignment = VerticalAlignment.Top;
- Itembox.Width = 194;
- Itembox.Height = 30;
- Itembox.IsEditable = false;
- Itembox.Name = "ReportData" + j.ToString() ;
- ComboBoxItem cboxItem = new ComboBoxItem();
- cboxItem.Content = ActualColumnsList[j];
- Itembox.Items.Add(cboxItem);
- ReportDropDown.Children.Add(Itembox);
- }