Results 1 to 2 of 2

Thread: Too Many Items

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,143

    Too Many Items

    I have a form that should have a combobox on it. The problem is that the combobox is bound to a dataview that has somewhere in excess of 32K rows. Clearly, showing or even populating that number is impractical. This is a case where an autocomplete makes sense, which is what I was doing in a WinForms version of this. However, the WPF combobox appears to attempt to load the whole 32K rows. The form locks up tight when I click the down arrow on the combobox. If I limit the dataview to only 10 rows, it works as expected.

    I haven't gone searching for this extensively, but with what I have looked for, I haven't seen anybody mention this issue. WinForms knew that populating 32K records was impractical, and binding the CB to at datatable was just fine. In WPF, I'm binding to a DataView rather than a datatable, but I would still expect it to be fine.

    What am I missing?

    The XAML I'm using looks like this:

    Code:
    <ComboBox Grid.Column="1" x:Name="cbStreams" ItemsSource="{Binding StreamNameView, Mode=OneWay}" DisplayMemberPath="HName" SelectedValuePath="LLID" MinWidth="240" Height="30" Margin="20,20,20,20"  IsEditable="False"/>
    My usual boring signature: Nothing

  2. #2

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,143

    Re: Too Many Items

    After a bit of investigating, this appears to be a thing. WPF controls just aren't as effective, as far as I can tell. I'd say this is due to the very flexibility of WPF. Since a combobox can contain ANYTHING in WPF, rather than just strings, the visual display is composed each and every time the form is displayed, and it can be excessive.

    One option is here:

    http://vbcity.com/blogs/xtab/archive...rformance.aspx

    which looks fairly nice, though it does take a bit of work. I switched to using the DevExpress ComboBoxEdit control, since this project is already fundamentally tied to DevExpress controls. Their ComboBoxEdit behaves much closer to what I expected from WinForms, as far as performance is concerned. It's still not perfect, as there's a slight delay, but then again, for my purpose, the user likely won't enter anything into the combobox anyways.

    Combining the VirtualizingStackPanel into the DevExpress ComboBoxEdit had no noticeable benefit, though no noticeable harm, either.
    Last edited by Shaggy Hiker; Feb 16th, 2023 at 12:26 PM.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width