WPF: ListBox with WrapPanel, vertical scrolling problem -


I have a UserControl (XAML below) which has a listbox that I want to display the images inside of Verpain, where Pictures are displayed as people who fit on a line and then wrap on the next line etc. This works, when the list increases more than the available space in the box window, I can not find a vertical scrollbar, i.e. the content is clipped. If I set a certain height on the ListBox, the scrollbar appears and works as expected, how can I get this listbox available to the available space and then show a vertical scrollbar? This control is inside the StackPanel inside a grid in the main window. If I wrap the steakpanel inside the scrollover, then I get that scrollbar, but this is not really a good solution if I add some control over the userbutton (like the image size "zoom" etc.) above the listbox I do not want to scroll with images.

Thank you !! :)

  & lt; UserControl x: Class = "GalleryAdmin.UI.GalleryView" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/ 2006 / xaml "& gt; & Lt; List Box Name = "Itemlistbox" Border = "0" ItemSource = "{Binding}" Scrollview. Horizontal scrollability = "disabled" & gt; & Lt; ListBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Stackpanel background = "light gray" margin = "5" & gt; & Lt; Stackpayel margin = "5" & gt; & Lt; Image source = "{binding path = local thumbpost}" height = "100" /> & Lt; TextBlock Text = "{Binding Path = Name}" TextElement = "Center" & gt; & Lt; / TextBlock & gt; & Lt; / StackPanel & gt; & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt; & Lt; /ListBox.ItemTemplate> & Lt; ListBox.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; WrapPanel / & gt; & Lt; / ItemsPanelTemplate & gt; & Lt; /ListBox.ItemsPanel> & Lt; / ListBox & gt;  

I think you override ItemPanelTemplate :

& lt; Grid & gt; & Lt; Listbock ScrollViewer.HorizontalScrollBarVisibility = "Disabled" & gt; & Lt; ListBox.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; WrapPanel IsItemsHost = "True" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ListBox.ItemsPanel> & Lt; ListBoxItem & gt; List box items 1 & lt; / ListBoxItem & gt; & Lt; ListBoxItem & gt; List box item 2 & lt; / ListBoxItem & gt; & Lt; ListBoxItem & gt; List box item 3 & lt; / ListBoxItem & gt; & Lt; ListBoxItem & gt; List Box Item 4 & lt; / ListBoxItem & gt; & Lt; ListBoxItem & gt; List Box Item 5 & lt; / ListBoxItem & gt; & Lt; / ListBox & gt;


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -