Class SfPicker
Represents the base class for creating drop-down controls with SpinnerView such as DatePicker, TimePicker etc.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Editors
Assembly: Syncfusion.Editors.WinUI.dll
Syntax
public class SfPicker : SfDropDownBase, IDisposableConstructors
SfPicker()
Initializes a new instance of the SfPicker class.
Declaration
public SfPicker()Fields
ColumnsProperty
Identifies Columns dependency property.
Declaration
public static readonly DependencyProperty ColumnsPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
DropDownHeaderProperty
Identifies DropDownHeader dependency property.
Declaration
public static readonly DependencyProperty DropDownHeaderPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
DropDownHeaderTemplateProperty
Identifies DropDownHeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty DropDownHeaderTemplatePropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
ItemHeightProperty
Identifies ItemHeight dependency property.
Declaration
public static readonly DependencyProperty ItemHeightPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
ItemWidthProperty
Identifies ItemWidth dependency property.
Declaration
public static readonly DependencyProperty ItemWidthPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
MaxItemWidthProperty
Identifies MaxItemWidth dependency property.
Declaration
public static readonly DependencyProperty MaxItemWidthPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
MinItemWidthProperty
Identifies MinItemWidth dependency property.
Declaration
public static readonly DependencyProperty MinItemWidthPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
ShowColumnHeadersProperty
Identifies ShowColumnHeaders dependency property.
Declaration
public static readonly DependencyProperty ShowColumnHeadersPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
ShowDropDownHeaderProperty
Identifies ShowDropDownHeader dependency property.
Declaration
public static readonly DependencyProperty ShowDropDownHeaderPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
VisibleItemsCountProperty
Identifies VisibleItemsCount dependency property.
Declaration
public static readonly DependencyProperty VisibleItemsCountPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
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:SfPicker x:Name="picker">
  <spinner:SfPicker.Columns>
     <spinner:SpinnerColumn x:Name="dayColumn" Header="Day" />
     <spinner:SpinnerColumn Header="Month" />
     <spinner:SpinnerColumn Header="Year" />
  </spinner:SfPicker.Columns>
</spinner:SfPicker>DropDownHeader
Gets or sets the header for drop-down.
Declaration
public object DropDownHeader { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Object | The object defines the header for drop-down. The default value is null. | 
Remarks
The drop-down header will be automatically collapsed, when value is null. DropDownHeaderTemplate is used to customize the UI of DropDownHeader.
DropDownHeaderTemplate
Gets or sets the DataTemplate that defines the visual representation of the drop-down Header.
Declaration
public DataTemplate DropDownHeaderTemplate { get; set; }Property Value
| Type | Description | 
|---|---|
| Microsoft.UI.Xaml.DataTemplate | The DataTemplate that defines the visual representation of the drop-down header. The default value is null. | 
Remarks
The drop-down header will be automatically collapsed, when value is null.
The DropDownHeader value is the data context of this DataTemplate.
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> | Default value 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 drop-down can be shown or not.
Declaration
public bool ShowColumnHeaders { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | true if drop-down column Header can be shown; otherwise, false.The default value is false. | 
ShowDropDownHeader
Gets or sets a value indicating whether the drop-down Header can be shown or not.
Declaration
public bool ShowDropDownHeader { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | true if drop-down Header is shown; otherwise, false.The default value is false. | 
VisibleItemsCount
Gets or sets the number of SpinnerItem that is visible to the drop-down.
Declaration
public int VisibleItemsCount { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | The number of items that is displayed in drop-down. The default value is -1. | 
Examples
<spinner:SfPicker x:Name="picker" VisibleItemsCount="5">
  <spinner:SfPicker.Columns>
      <spinner:SpinnerColumn Header="Day" />
      <spinner:SpinnerColumn Header="Month" />
      <spinner:SpinnerColumn Header="Year" />
  </spinner:SfPicker.Columns>
</spinner:SfPicker>Methods
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. | 
OnAcceptButtonClicked()
Called when Accept button is clicked.
Declaration
protected override void OnAcceptButtonClicked()Overrides
OnApplyTemplate()
Declaration
protected override void OnApplyTemplate()Overrides
Events
ItemPrepared
Occurs each time an element is made ready for use.
Declaration
public event EventHandler<SpinnerItemPreparedEventArgs> ItemPreparedEvent Type
| Type | 
|---|
| System.EventHandler<SpinnerItemPreparedEventArgs> | 
SelectionChanged
Occurs when the selection is changed in SpinnerColumnView.
Declaration
public event EventHandler<SpinnerItemSelectionChangedEventArgs> SelectionChangedEvent Type
| Type | 
|---|
| System.EventHandler<SpinnerItemSelectionChangedEventArgs> | 
Remarks
This event occurs whenever there is a change to a selection. A selection can be changed by user interaction like scrolling, key navigation as well as other set values.