Note that there are some explanatory texts on larger screens.

plurals
  1. POComboBox locks at application start
    primarykey
    data
    text
    <p>Ok, this is a strange one (or I'm doing something stupidly). I have a WPF combobox which is populated with a string array on form load (app start). This part works fine. The sticky bit is when I try to alter any of the information within said combobox. The debug says that it is changing but nothing is being shown visually.</p> <pre><code>// Populate the combobox: private void ComboBlocks() { comboBox1.Items.Clear(); string[,] _tmp = _kits.BlockIDNames; string[] _tmp1 = new string[_tmp.GetLength(0)]; for (int i = 0; i &lt; _tmp.GetLength(0); i++) { _tmp1[i] = _tmp[i, 0] + " - " + _tmp[i, 1]; } foreach (string s in _tmp1) { string[] _tmpS1 = s.Split(new char[] { '-' }); int _tmpS2 = Convert.ToInt32(_tmpS1[0].Trim()); bool _banneditem = _cbi.BannedItemExists(_tmpS2); if (_banneditem == true) AddComboItem(s, true); else AddComboItem(s); } if (comboBox1.Items.Count &gt; 0) comboBox1.SelectedIndex = 0; } // Add item to combobox: private void AddComboItem(string _text,bool _redtext = false) { Grid grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); TextBlock text = new TextBlock(); text.Text = _text; if (_redtext == true) text.Foreground = Brushes.Red; else text.Foreground = Brushes.Black; grid.Children.Add(text); Grid.SetColumn(text, 0); ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = grid; comboBoxItem.Tag = _text; comboBox1.Items.Add(comboBoxItem); } </code></pre> <p>Also, I am fairly new to C# so if there is anything that I'm doing wrong/inefficiently, please point it out.</p> <p>Many thanks.</p> <p>EDIT: Iterating through each one and changing the text value would probably be just as much work as it gets its information from another array. It would have to check for each item in the array and if it exists, colour it red, if it doesn't, colour it black.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload