menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SpinnerView - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SpinnerView

    Represents a control that displays the collection of SpinnerColumnView data in a list format.

    Inheritance
    System.Object
    SpinnerView
    DateTimeSpinnerBase
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.Editors
    Assembly: Syncfusion.Editors.WinUI.dll
    Syntax
    public class SpinnerView : Control, IDisposable

    Constructors

    SpinnerView()

    Initializes a new instance of the SpinnerView class.

    Declaration
    public SpinnerView()

    Fields

    ColumnsProperty

    Identifies Columns dependency property.

    Declaration
    public static readonly DependencyProperty ColumnsProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the Columns dependency property.

    HeaderProperty

    Identifies Header dependency property.

    Declaration
    public static readonly DependencyProperty HeaderProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the Header dependency property.

    HeaderTemplateProperty

    Identifies HeaderTemplate dependency property.

    Declaration
    public static readonly DependencyProperty HeaderTemplateProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the HeaderTemplate dependency property.

    ItemHeightProperty

    Identifies ItemHeight dependency property.

    Declaration
    public static readonly DependencyProperty ItemHeightProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the ItemHeight dependency property.

    ItemWidthProperty

    Identifies ItemWidth dependency property.

    Declaration
    public static readonly DependencyProperty ItemWidthProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the ItemWidth dependency property.

    MaxItemWidthProperty

    Identifies MaxItemWidth dependency property.

    Declaration
    public static readonly DependencyProperty MaxItemWidthProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the MaxItemWidth dependency property.

    MinItemWidthProperty

    Identifies MinItemWidth dependency property.

    Declaration
    public static readonly DependencyProperty MinItemWidthProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the MinItemWidth dependency property.

    ShowColumnHeadersProperty

    Identifies ShowColumnHeaders dependency property.

    Declaration
    public static readonly DependencyProperty ShowColumnHeadersProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the ShowColumnHeaders dependency property.

    ShowHeaderProperty

    Identifies ShowHeader dependency property.

    Declaration
    public static readonly DependencyProperty ShowHeaderProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the ShowHeader dependency property.

    VisibleItemsCountProperty

    Identifies VisibleItemsCount dependency property.

    Declaration
    public static readonly DependencyProperty VisibleItemsCountProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for the VisibleItemsCount dependency property.

    Properties

    Columns

    Gets or sets a collection of spinner column that can be populated as SpinnerColumnView based on ItemsSource in SpinnerView.

    Declaration
    public SpinnerColumns Columns { get; set; }
    Property Value
    Type Description
    SpinnerColumns

    The default value is null.

    Examples
    <spinner:SpinnerView x:Name="picker">
      <spinner:SpinnerView.Columns>
         <spinner:SpinnerColumn x:Name="dayColumn" Header="Day" />
         <spinner:SpinnerColumn Header="Month" />
         <spinner:SpinnerColumn Header="Year" />
      </spinner:SpinnerView.Columns>
    </spinner:SpinnerView>
    ObservableCollection<string> dayCollection = new ObservableCollection<string>();
    for (int i = 1; i <= 31; i++)
    {
       dayCollection.Add(i.ToString());
    }
    dayColumn.ItemsSource = dayCollection;

    Header

    Gets or sets the header for SpinnerView.

    Declaration
    public object Header { get; set; }
    Property Value
    Type Description
    System.Object

    The default value is null.

    Remarks

    The spinner header will be automatically collapsed, when value is null.

    Examples

    The following example shows how to define a Header for the SpinnerView control.

    <spinner:SpinnerView
        x:Name="picker"
        ShowHeader="true"
        Header="Select a date">
      <spinner:SpinnerView.Columns>
          <spinner:SpinnerColumn Header="Day" />
          <spinner:SpinnerColumn Header="Month" />
          <spinner:SpinnerColumn Header="Year" />
      </spinner:SpinnerView.Columns>
    </spinner:SpinnerView>

    HeaderTemplate

    Gets or sets the DataTemplate that defines the visual representation of the spinner header.

    Declaration
    public DataTemplate HeaderTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.DataTemplate

    The DataTemplate that defines the visual representation of the spinner header. The default value is null.

    Remarks

    The spinner header will be automatically collapsed, when value is null. The Header value is the context of this template.

    Examples

    The following example shows how to define a HeaderTemplate for the SpinnerView control.

    <Page.Resources>
        <DataTemplate x:Name="HeaderTemplate">
            <Grid Background="PaleGreen">
                 <TextBlock
                     HorizontalAlignment="Center"
                     VerticalAlignment="Center"
                     Foreground="Red"
                     Text="{Binding}" />
            </Grid>
        </DataTemplate>
    </Page.Resources>
    <Grid>
        <spinner:SpinnerView
             x:Name="picker"
             ShowHeader="true"
             HeaderTemplate="{StaticResource HeaderTemplate}">
            <spinner:SpinnerView.Columns>
                <spinner:SpinnerColumn Header="Day" />
                <spinner:SpinnerColumn Header="Month" />
                <spinner:SpinnerColumn Header="Year" />
            </spinner:SpinnerView.Columns>
        </spinner:SpinnerView>
    </Grid>

    ItemHeight

    Gets or sets the uniform height for all SpinnerItem in SpinnerColumnView.

    Declaration
    public double ItemHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The height of each item in SpinnerColumnView. The default value is 40. ItemHeight does not supports System.Double.NaN value.

    ItemWidth

    Gets or sets the uniform width for all SpinnerItem in SpinnerColumnView.

    Declaration
    public double ItemWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The width of each items in SpinnerColumnView. The default value is 80.

    Remarks

    If ItemWidth is NaN, item will automatically resize according to its content.

    MaxItemWidth

    Gets or sets the maximum width for all SpinnerItem in SpinnerColumnView.

    Declaration
    public double MaxItemWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The maximum width of each item in SpinnerColumnView items. The default value is System.Double.PositiveInfinity.

    MinItemWidth

    Gets or sets the minimum width for all SpinnerItem in SpinnerColumnView.

    Declaration
    public double MinItemWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The minimum width of each item in SpinnerColumnView items. The default value is 0.

    SelectedItem

    Gets the collection of selected items of Columns.

    Declaration
    public List<object> SelectedItem { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.Object>

    The default is null.

    Remarks

    The SelectedItem maintained in the same order as in Columns collection.

    ShowColumnHeaders

    Gets or sets a value indicating whether the Header of each column in spinner view can be shown or not.

    Declaration
    public bool ShowColumnHeaders { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if spinner view column Header can be shown; otherwise, false.The default value is false.

    ShowHeader

    Gets or sets a value indicating whether the spinner header can be shown or not.

    Declaration
    public bool ShowHeader { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if spinner header is shown; otherwise, false. The default value is false.

    Examples
    <spinner:SpinnerView x:Name="picker" ShowHeader="True">
      <spinner:SpinnerView.Columns>
          <spinner:SpinnerColumn Header="Day" />
          <spinner:SpinnerColumn Header="Month" />
          <spinner:SpinnerColumn Header="Year" />
      </spinner:SpinnerView.Columns>
    </spinner:SpinnerView>

    VisibleItemsCount

    Gets or sets the number of SpinnerItem that is visible in SpinnerView.

    Declaration
    public int VisibleItemsCount { get; set; }
    Property Value
    Type Description
    System.Int32

    The number of items that is displayed in spinner view. The default value is -1.

    Remarks

    If SpinnerView height is not set and VisibleItemsCount has some value, SpinnerView control renders the visual items based on VisibleItemsCount. SpinnerColumn.ItemWidth and SpinnerColumn.ItemHeight will not have any effect. If SpinnerView height is set and VisibleItemsCount has some value, SpinnerView control renders the visual items based on Height instead of VisibleItemsCount. Both, Height and VisibleItemsCount not set. SpinnerView control renders the visual items based on Actual Height.

    Examples
    <spinner:SpinnerView x:Name="picker" VisibleItemsCount="5">
      <spinner:SpinnerView.Columns>
          <spinner:SpinnerColumn Header="Day" />
          <spinner:SpinnerColumn Header="Month" />
          <spinner:SpinnerColumn Header="Year" />
      </spinner:SpinnerView.Columns>
    </spinner:SpinnerView>

    Methods

    Dispose()

    Release the unmanaged resources of SpinnerView.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Release the unmanaged resources of SpinnerView.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Used to indicate perform dispose or not.

    InvalidateColumn(Int32)

    Helps to invalidate specific column in SpinnerView.

    Declaration
    public void InvalidateColumn(int columnIndex)
    Parameters
    Type Name Description
    System.Int32 columnIndex

    The column index.

    ItemPrepared(Int32, ISpinnerItemInfo, SpinnerItem)

    Invoked each time an element is made ready for use.

    Declaration
    public virtual void ItemPrepared(int index, ISpinnerItemInfo spinnerItemInfo, SpinnerItem element)
    Parameters
    Type Name Description
    System.Int32 index

    The column index.

    ISpinnerItemInfo spinnerItemInfo

    The spinner item info.

    SpinnerItem element

    The spinner item.

    Remarks

    This method is invoked for both a newly created element as well as an element that already exists and is being re-used from the recycle queue.

    OnApplyTemplate()

    Declaration
    protected override void OnApplyTemplate()

    OnCreateAutomationPeer()

    Declaration
    protected override AutomationPeer OnCreateAutomationPeer()
    Returns
    Type
    Microsoft.UI.Xaml.Automation.Peers.AutomationPeer

    OnSelectionChanged(SpinnerItemSelectionChangedEventArgs)

    Invoked when the selection is changed in SpinnerColumnView.

    Declaration
    public virtual void OnSelectionChanged(SpinnerItemSelectionChangedEventArgs eventArgs)
    Parameters
    Type Name Description
    SpinnerItemSelectionChangedEventArgs eventArgs

    Contains details regarding old and new selected index value.

    Remarks

    This method occurs whenever there is a change to a selection. A selection can be changed programmatically or by user interaction like scrolling, key navigation.

    Events

    SelectionChanged

    Occurs when the selection is changed in SpinnerColumnView.

    Declaration
    public event EventHandler<SpinnerItemSelectionChangedEventArgs> SelectionChanged
    Event Type
    Type
    System.EventHandler<SpinnerItemSelectionChangedEventArgs>
    Remarks

    A selection can be changed programmatically or by user interaction like scrolling, key navigation.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved