xaml 进阶控件
ScrollView
作用:让内容可滚动(支持垂直或水平滚动)。
常用属性:
Orientation
:滚动方向(Vertical/Horizontal)Content
:内部内容Padding
、Margin
、BackgroundColor
CollectionView
作用:高性能列表/网格布局,支持数据绑定、分组、选择等。
常用属性:
ItemsSource
:数据源ItemTemplate
:单元格模板ItemsLayout
:布局方式(垂直列表、水平列表、网格)SelectionMode
、SelectedItem
Header
、Footer
CarouselView
作用:轮播图、滑动页面。
常用属性:
ItemsSource
、ItemTemplate
IsBounceEnabled
、PeekAreaInsets
Loop
、Position
Frame
作用:带圆角、阴影的内容容器,常用于卡片、面板。
常用属性:
CornerRadius
:圆角半径HasShadow
:是否有阴影BorderColor
、BackgroundColor
Content
Border(.NET MAUI 新增)
作用:为内容添加边框和圆角。
常用属性:
Stroke
:边框颜色StrokeThickness
:边框宽度StrokeShape
:边框形状(圆角、椭圆等)Background
、Content
ContentPresenter
作用:用于自定义控件模板时占位显示内容。
常用属性:
Content
:要显示的内容
Expander
作用:可展开/收起的内容区域。
无评论