Adding GroupStyle HeaderTemplate disables scrollbar in ComboBox

425
2
03-16-2021 09:54 AM
WilliamYu
New Contributor

Hi,

I am having an issue where my scrollbar on my ComboBox disappears when I add a HeaderTemplate to my ComboBox. The scrollbar does not show even when the number of items in my ComboBox exceeds the height of the dropdown. When I remove the HeaderTemplate, the scrollbar reappears.

<ComboBox.GroupStyle> 
      <GroupStyle HeaderTemplate="{StaticResource LayerHeaderTemplate}"/>
</ComboBox.GroupStyle>

 

When I change the ScrollViewer's CanContentScroll Property, the scrollbar appears but I lose the ComboBox default style.

 

<ComboBox.Style>
   <Style TargetType="{x:Type ComboBox}">
      <Style.Triggers>
        <Trigger Property="IsGrouping"
           Value="true">
          <Setter Property="ScrollViewer.CanContentScroll"
             Value="false"/>
         </Trigger>
       </Style.Triggers>
   </Style>
</ComboBox.Style>

 

Is there a way to use a HeaderTemplate, maintain ComboBox's default Esri Style, and have the ScrollBar showing?

0 Kudos
2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

There is a sample that is using a ListBox with a GroupStyle maybe that can give you some insight.  This sample  displays the scrollbars when needed:

Wolf_0-1616005916961.png

the sample is here: arcgis-pro-sdk-community-samples/Map-Authoring/GeocodingTools at master · Esri/arcgis-pro-sdk-commun...

 

WilliamYu
New Contributor

Hi Wolf,

Thank you for the reply! I looked at the ListBox example and tried the same implementation on my ComboBox for the GroupStyle. The scrollbar still does not appear. I then changed my original code for the  ComboBox and changed ComboBox to a ListBox and left everything else the same. There was a scrollbar and header for the items in my ListBox. If I override the Esri style for ComboBox, I'll get the header and the scrollbar but will not get Esri's style for ComboBox. This is more noticeable in Dark Theme as the background for the dropdown is set to white. I've tested this in Pro 2.2 and 2.6 and have gotten the same result. I was wondering if I am missing anything with ComboBox or would have to style UIElements such as ToggleButton and Popup within ComboBox.

 

 

Thanks,


Will

0 Kudos