商城首页欢迎来到中国正版软件门户

您的位置:首页 >WPF WrapPanel使用与布局技巧

WPF WrapPanel使用与布局技巧

  发布于2025-08-18 阅读(0)

扫一扫,手机访问

大家好,又见面了,我是你们的朋友全栈君。

WrapPanel布局面板将各个控件从左至右按照行或列的顺序罗列,当长度或高度不够是就会自动调整进行换行,后续排序按照从上至下或从右至左的顺序进行。

Orientation——根据内容自动换行。当 Horizontal选项看上去类似于Windows资源管理器的缩略图视图:元素是从左向右排列的,然后自上至下自动换行。Vertical 选项看上去类似于Windows资源管理器的列表视图:元素是从上向下排列的,然后从左至右自动换行。

ItemHeight——所有子元素都一致的高度。每个子元素填充高度的方式取决于它的VerticalAlignment属性、Height属性等。任何比ItemHeight高的元素都将被截断。

ItemWidth——所有子元素都一致的宽度。每个子元素填充高度的方式取决于它的VerticalAlignment属性、Width属性等。任何比ItemWidth高的元素都将被截断。

Horizontal横着排列出来,不够排的情况下会自动上下换行

xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″

xmlns:local=”clr-namespace:WpfCS.布局面板”

mc:Ignorable=”d”

Title=”WrapPanel” Height=”300″ Width=”300″>

WPF WrapPanel

Vertical竖着排列出来,不够排的情况下会自动左右换行

xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″

xmlns:local=”clr-namespace:WpfCS.布局面板”

mc:Ignorable=”d”

Title=”WrapPanel” Height=”300″ Width=”300″>

WPF WrapPanel

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/163305.html原文链接:https://javaforall.cn

本文转载于:https://cloud.tencent.com/developer/article/2107311 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。

热门关注