Note that there are some explanatory texts on larger screens.

plurals
  1. POstring[] count is passed to ComboBox, but string[] value is not
    primarykey
    data
    text
    <p>i've used a method, </p> <pre><code>public static string[] getMyStrings() </code></pre> <p>and passed it to a combobox like: </p> <pre><code>cmbMyBox.itemsSource = getMyStrings(). //(more detail below) </code></pre> <p>the debugger shows the strings have been added to the combobox, but when i look in the combobox the number of entries are there, but blank. anyone know what i'm doing wrong?</p> <p><strong>my list of devices:</strong></p> <pre><code>public static string[] GetMIDIInDevices() { //get list of devices string[] returnDevices = new string[MidiIn.NumberOfDevices]; // Get the product name for each device found for (int device = 0; device &lt; MidiIn.NumberOfDevices; device++) { returnDevices[device] = MidiIn.DeviceInfo(device).ProductName; } return returnDevices; } </code></pre> <p><strong>The simple code to display it on my main window in WPF:</strong></p> <pre><code>public MainWindow() { InitializeComponent(); cmbMidiDropdown.ItemsSource = NAudioMIDI.GetMIDIInDevices(); //LoadMidiInDevicesIntoComboBox(); } </code></pre> <p><strong>here's the XAML:</strong></p> <pre><code>&lt;TabItem Header="MIDI Settings" Name="tabMidiSettings" Background="DarkGoldenrod"&gt; &lt;Grid Background="Honeydew"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="10" /&gt; &lt;ColumnDefinition Width="758" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;ComboBox Grid.Column="1" Height="23" HorizontalAlignment="Right" Margin="0,141,146,0" Name="cmbMidiDropdown" VerticalAlignment="Top" Width="312" ItemsSource="{Binding}" DisplayMemberPath="Name" /&gt; &lt;Label Content="Select Midi Input device" Grid.Column="1" Height="28" HorizontalAlignment="Left" Margin="143,141,0,0" Name="label1" VerticalAlignment="Top" /&gt; &lt;/Grid&gt; &lt;/TabItem&gt; </code></pre> <p><strong>DEBUGGER OUTPUT:</strong></p> <p><strong>GetMIDIInDevices()</strong></p> <pre><code>- returnDevices {string[3]} string[] [0] "MIDISPORT 2x2 In A" string [1] "MIDISPORT 2x2 In B" string [2] "Turtle Beach USB MIDI 1x1" string returnDevices[device] "Turtle Beach USB MIDI 1x1" string </code></pre> <p><strong>cmbMIDIDropdown</strong></p> <pre><code>+ cmbMidiDropdown {System.Windows.Controls.ComboBox Items.Count:3} - cmbMidiDropdown.ItemsSource {string[3]} - [string[]] {string[3]} string[] [0] "MIDISPORT 2x2 In A" string [1] "MIDISPORT 2x2 In B" string [2] "Turtle Beach USB MIDI 1x1" string </code></pre>
    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