跳转到主要内容

xaml 进阶控件

 ScrollView

作用:让内容可滚动(支持垂直或水平滚动)。

常用属性:

  • Orientation:滚动方向(Vertical/Horizontal)
  • Content:内部内容
  • PaddingMarginBackgroundColor


CollectionView

作用:高性能列表/网格布局,支持数据绑定、分组、选择等。

常用属性:

  • ItemsSource:数据源
  • ItemTemplate:单元格模板
  • ItemsLayout:布局方式(垂直列表、水平列表、网格)
  • SelectionModeSelectedItem
  • HeaderFooter

CarouselView

作用:轮播图、滑动页面。

常用属性:

  • ItemsSourceItemTemplate
  • IsBounceEnabledPeekAreaInsets
  • LoopPosition

Frame

作用:带圆角、阴影的内容容器,常用于卡片、面板。

常用属性:

  • CornerRadius:圆角半径
  • HasShadow:是否有阴影
  • BorderColorBackgroundColor
  • Content

Border(.NET MAUI 新增)

作用:为内容添加边框和圆角。

常用属性:

  • Stroke:边框颜色
  • StrokeThickness:边框宽度
  • StrokeShape:边框形状(圆角、椭圆等)
  • BackgroundContent

ContentPresenter

作用:用于自定义控件模板时占位显示内容。

常用属性:

  • Content:要显示的内容

Expander

作用:可展开/收起的内容区域。