question

65010773 avatar image
0 Votes"
65010773 asked 65010773 answered

How to get content of comboitem

Hi

I have a combobox containing comboboxitems

  private void Designcombo( ref ComboBox combo ,  int from, int upto , int dropheight )
             {
            ComboBoxItem cbitem;
             for(int i = from; i<=upto;i++)
                 {
               cbitem = new ComboBoxItem();
        
                 cbitem.Background = brushseg;
                 cbitem.FontFamily = new FontFamily("calibri");
                 cbitem.FontWeight = Windows.UI.Text.FontWeights.Bold;
                 cbitem.FontSize = 21;
                 cbitem.Height = 36;
                     if (flagheb)
                         cbitem.Content = i.ToString() + " " + blabla(i);
                     else
                         cbitem.Content = i.ToString();
                     combo.Items.Add(cbitem);
        
                 }
             }

Given combo.selectedindex how to retrieve the content of its comboboxitem ?



windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

65010773 avatar image
0 Votes"
65010773 answered

I found

((ComboBoxItem) mycombo.Items[mycombo.SelectedIndex]).Content.ToString();

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.