Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight combobox number of items shown refresh
    primarykey
    data
    text
    <p>I have two combo boxes on a SL page. When Combo 1 updates, a service is called and populates Combo 2. </p> <p>On the first call, 3 results are returned. When the combo box is expanded, you can see all 3 options.</p> <p>On the second call, 4 results are returned. When the combo box is expanded, you can see 3 options, with a vertical scroll bar.</p> <p>If I reload and do those steps in reverse, I get 4 rows the first call and 3 rows + a blank row on the second call. (No, the blank is not a record. It cannot be selected.)</p> <p>It appears that the drop down list size keeps the first generated height.</p> <p>How can I refresh the combo box max items shown after each service call?</p> <p>Thanks!</p> <p><strong>Edit #1</strong></p> <p>The code follows the M-V-VM pattern. When the page loads, the <code>Group1</code> populates the first combo box, and nothing is selected. When the user makes a selection, that selection is bound to Group1Selection.</p> <pre><code>&lt;ComboBox ItemsSource="{Binding Path=Group1}" SelectedItem="{Binding Path=Group1Selection}" /&gt; &lt;ComboBox ItemsSource="{Binding Path=Group2}" SelectedItem="{Binding Path=Group2Selection}" /&gt; </code></pre> <p>In the viewmodel, in the set accessor of the <code>Group1Selection</code> property, I have something like</p> <pre><code>set { if (group1Selection != value) { group1Selection = value; PopulateGroup2(); OnPropertyChanged("Group1Selection"); } } </code></pre> <p>Where PopulateGroup2 performs my service call async, gets the data, and puts that data into the exposed property of <code>Group2</code>.</p> <p>Under "normal" conditions, this isn't a problem, since most options have dozens of possible selections. However, a couple of the <code>Group1</code> choices only have 3 or 4 child choices. If one of those is selected first, then the height of the ComboBox, for the rest of that application instance is set to 3 or 4, respectively, instead of maxing out at 8 shown items.</p> <p>Following the M-V-VM pattern, there is no code in the code-behind.</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.
 

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