views:

94

answers:

1

I have a standard listbox. I can add items using a input textbox. I can delete them using delete key or context menu. When i delete the items from top of the list, scrollbar resizes properly. If i scroll to the bottom and then delete items the scrollbar resizes incorrectly i.e instead of increasing in size it decreases in size. If i scroll up using mouse or up key then it shows correct scrollbar size. Also when i delete last item, an empty space is left istead of items moving down. Any ideas? Thanks.

+1  A: 

Try to apply this style to ListBox.ItemsContainerStyle:

<Style x:Key="OnTopItemContainerStyle"  TargetType="{x:Type ListBoxItem}">
    <Setter Property="VerticalAlignment" Value="Top"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
</Style>

Hope it helps.

levanovd