Reputation: 399
i have a ListBox
which is filled with images as items. works all fine and as intended so far. but the vertical scrollbar covers the right part of the images. how can i prevent that?
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<ListBoxItem>
<Image Source="/BFH;component/Images/PackingPictures/1.jpg"/>
</ListBoxItem>
<ListBoxItem>
<Image Source="/BFH;component/Images/PackingPictures/2.jpg"/>
</ListBoxItem>
</ListBox>
Upvotes: 0
Views: 1197
Reputation: 399
thanks to dkozl, here is the right answer:
HorizontalScrollBarVisibility="Hidden"
does not disable horizontal scrolling only hides horizontal scrollbar. Try with Disable
otherwise your item is given more space horizontally then you can see.
so the solution is:
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disable">
<ListBoxItem>
<Image Source="/BFH;component/Images/PackingPictures/1.jpg"/>
</ListBoxItem>
<ListBoxItem>
<Image Source="/BFH;component/Images/PackingPictures/2.jpg"/>
</ListBoxItem>
</ListBox>
Upvotes: 2