maui-devexpress-dot-maui-dot-collectionview-dot-dxcollectionview-ad9db70a.md
Gets or sets the number of layout columns or rows (depending on Orientation) that are used to arrange CollectionView items. This is a bindable property.
Namespace : DevExpress.Maui.CollectionView
Assembly : DevExpress.Maui.CollectionView.dll
NuGet Package : DevExpress.Maui.CollectionView
public int ItemSpanCount { get; set; }
| Type | Description |
|---|---|
| Int32 |
The number of layout spans in DXCollectionView.
|
The following schema shows how the DXCollectionView control positions items in multi-span mode for different DXCollectionView.Orientation values:
The following functionality is not supported for DXCollectionView instances with ItemSpanCount set to a value greater than 1:
The following example specifies the ItemSpanCount property value depending on screen orientation. The example positions two CollectionView items per row for Portrait device orientation and three items for Landscape orientation:
<dxcv:DXCollectionView x:Name="collectionView"
Orientation="Vertical"
ItemsSource="{Binding ItemsSource}"
ItemTemplate="{StaticResource houseCardTemplate}"...>
<VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup>
<VisualState x:Name="Portrait">
<VisualState.StateTriggers>
<OrientationStateTrigger Orientation="Portrait" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Property="ItemSpanCount" Value="2" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Landscape">
<VisualState.StateTriggers>
<OrientationStateTrigger Orientation="Landscape" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Property="ItemSpanCount" Value="3" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
</dxcv:DXCollectionView>
See Also