-1

I have a combo box which is filled with checkbox items.
When I scroll down I would like to have the first item of the combo box to always be visible.
It should kind of look like the the navigation bar on this or other websites.

Thanks in advance.

Daniel M
  • 746
  • 5
  • 13
  • This concept is called *freezing* (frozen column, frozen row, etc.), e.g. [here](https://stackoverflow.com/q/22731690/1997232) is another question (but about DataGrid). To freeze something it has to be removed from scrollable content. In your case you have to re-define control template of drop-down (popup) part and insert on top additional container for such frozen items. – Sinatr Jan 16 '20 at 10:37

1 Answers1

1

You can modify control template, see this post how to extract it.

Below is ugly (but working) solution to see current selected item on top of popup, which you can modify to your liking:

For this you have to extract combobox control template as mentioned before, then search for

<Popup x:Name="PART_Popup"

and modify its

<Border x:Name="DropDownBorder"

by adding inside a Grid like this:

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <ContentControl Content="{TemplateBinding SelectionBoxItem}" />

Now just set grid row for ealier existing scroll viewer:

        <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">

don't forget to close Grid attribute after it:

</Grid>

Sinatr
  • 20,892
  • 15
  • 90
  • 319