Questions about the ListBox not being filled in the grid

Source: Internet
Author: User

WPF layout When you find a problem, the listbox in the grid, always can not fill the entire grid, but the view Code also does not set the relevant properties, originally set the listbox before the first to fill the container, The listbox can then fill the entire layout with the following code:

<ListBox.ItemContainerStyle>
<style targettype= "ListBoxItem" >
<setter property= "HorizontalAlignment" value= "Stretch" ></Setter>
<setter property= "horizontalcontentalignment" value= "Stretch" ></Setter>
</Style>
</ListBox.ItemContainerStyle>

This ensures that the listbox is filled with the entire interface, which actually sets the ListBoxItem container, and if the container cannot be filled with the grid, then the item must not be filled, and the final expression is that the ListBox cannot fill the layout container!

Questions about the ListBox not being filled in the grid

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.