WPF tutorial three; layout wrappanel panel

Source: Internet
Author: User
Tags truncated

WrapPanel: Surround Panel

The WrapPanel layout panel lists the controls from left to right in the order of rows or columns, automatically adjusting for line breaks when the length or height is insufficient, and subsequent sorting in order from top to bottom or right to left.

orientation--automatically wraps according to content. When the value of the Orientation property is set to horizontal: The element is arranged from left to right and then wrapped from top to bottom. When the value of the Orientation property is set to vertical: The element is arranged from top to bottom, and then the line wraps from left to right.

itemheight--all child elements have a consistent height. The way each child element fills the height depends on its VerticalAlignment property, height property, and so on. Any element higher than ItemHeight will be truncated.

itemwidth--all child elements have a consistent width. The way each child element fills the height depends on its VerticalAlignment property, the Width property, and so on. Any element higher than Itemwidth will be truncated.

1. The value of the Orientation property is set to horizontal

As shown in the next 2 figure, figure 1 is the effect of the form width of a child, figure 2 is the effect of the width of the form after pulling large

Figure 1

Figure 2

Using XAML code implementations:

1<window x:class="Wpfdemo.mainwindow"2xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"3xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"4title="wrappanel Panel"height="237"Width="525"windowstartuplocation="Centerscreen">5<wrappanel orientation="Horizontal">6<button width=" -"> button 1</button>7<button width=" -"> button 2</button>8<button width=" -"> button 3</button>9<button width=" -"> button 4</button>Ten<button width=" -"> button 5</button> One<button width=" -"> button 6</button> A</WrapPanel> -</Window>

2. The value of the Orientation property is set to vertical

As shown in the next 2 figure, figure 1 is the effect of a higher form height, and Figure 2 is the effect when the height of the form is small.

Figure 1

Figure 2

Using XAML code implementations:

1<window x:class="Wpfdemo.mainwindow"2xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"3xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"4title="wrappanel Panel"height="237"Width="525"windowstartuplocation="Centerscreen">5<wrappanel orientation="Vertical">6<button width=" -"> button 1</button>7<button width=" -"> button 2</button>8<button width=" -"> button 3</button>9<button width=" -"> button 4</button>Ten<button width=" -"> button 5</button> One<button width=" -"> button 6</button> A</WrapPanel> -</Window>

WPF tutorial three; layout wrappanel panel

Related Article

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.