I try to have a list of element that it is collapsed depending of a Dynamic configuration.
I arrive to bind the list and collpase the element but it seems that the scrollbar is not correctly refresh because if I have only 20 elements (e.g 10 first and 10 last) on 100 elements, the scrollbar take some times (and it is display strange) to scrolldown.
The element are collapsed when we open the combobox perhaps the scrollbar is already created ?
I think that the scrollbar contains also the element hidden. How we can change this to contains only element displayed.
How I can do a scrollbar that is limited to the number of Element?
Here is a small video where you can see my problem (it can be more clear):
Probleme Scrollbar.wmv - Google Drive[
^]
What I have tried:
I have create this combobox
<ComboBox
ItemsSource="{Binding Path=List, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Page}}}"
SelectedValue="{Binding Elements[0]}"
SelectedValuePath="Value">
<ComboBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Image Source="{Binding UriIcon, Converter={StaticResource UriToBitmapImage}}" Stretch="None" />
</WrapPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Here is the style of collapsed element
<Style x:Key="ComboBoxEnableItem" TargetType="{x:Type ComboBoxItem}">
<Setter Property="Visibility" Value="{Binding Path=IsEnabled, Converter={StaticResource b2v}}" />
</Style>
here is the dropdownopen function :
private void ComboBox_DropDownOpened(object sender, EventArgs e)
{
foreach (BottomAreaDisplay element in App.CurrentImplement.Model.BottomAreas.BottomAreaEnumList)
{
if (App.CurrentImplement.Model.BottomAreas.ElementShallBeDisplayed(element.Value))
element.IsEnabled = true;
else
element.IsEnabled = false;
}
}