Skip to content

Instantly share code, notes, and snippets.

@nigel-sampson
Created November 24, 2014 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nigel-sampson/db65e0355b428ded315b to your computer and use it in GitHub Desktop.
Save nigel-sampson/db65e0355b428ded315b to your computer and use it in GitHub Desktop.
Non scrolling combo box
<ComboBox
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollMode="Disabled"
ScrollViewer.VerticalScrollMode="Disabled">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
@ScottyLightnin
Copy link

This indeed delivers a ComboBox without the CarouselPanel, but then you lose all the nice inertia effects in touch mode.
Ideally, there would be a boolean property called AllowInfiniteScrolling which could be disabled.

For context, I have a SettingsFlyout with a bunch of comboboxes, most of which only contain 3 or 4 options in it. Until you reach some item count threshold, standard WinRT comboboxes behave without infinite scrolling. Add enough items to your combobox, and then infinite scrolling kicks in. Today is the day that one of those comboboxes now has enough items to trigger infinite scrolling, so now the visual behaviour is inconsistent with the other comboboxes on the view.

Thanks for supplying the gist though! For anyone who doesn't need the inertia effects, this will probably suit just fine. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment