Class SfListView
The SfListView is a control that displays the collection of data in vertical list.
Inherited Members
Namespace: Syncfusion.WinForms.ListView
Assembly: Syncfusion.SfListView.WinForms.dll
Syntax
public class SfListView : SfScrollControl, IDisposable, ISupportUpdate, IThemeProvider, IVisualStyle
Constructors
SfListView()
Initializes a new instance of the SfListView class.
Declaration
public SfListView()
Properties
AllowRecursiveChecking
Gets or sets a value indicating whether recursive checking can be enabled for group header and its items.
Declaration
public bool AllowRecursiveChecking { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
When recursive checking is enabled for LitView, the group header will be shown with the CheckBox. The whole group items will be selected or deselected while checking or unchecking the group header CheckBox.
AllowSelectAll
Gets or sets a value indicating whether the select all item can be shown at top of the ListView to select whole items.
Declaration
public bool AllowSelectAll { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowTriStateMode
Gets or sets a value indicating whether the tristate mode can be enabled for CheckBox to show the Indeterminate state.
Declaration
public bool AllowTriStateMode { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
The indeterminate state can be shown in CheckBox only if the CheckedMember is assigned to ListView.
AutoFitMode
Gets or sets a value indicating whether the SfListView auto fit the items based on its content.
Declaration
public AutoFitMode AutoFitMode { get; set; }
Property Value
Type |
---|
AutoFitMode |
AutoHideScrollBars
Gets or sets a value indicating whether the horizontal and vertical scrollbars should be automatically shown or hidden based on content overflow. When set to true, the scrollbars are managed dynamically according to the size of the content. When set to false, the visibility of the scrollbars depends on the HorizontalScrollbarVisible and VerticalScrollbarVisible properties.
Declaration
public bool AutoHideScrollBars { get; set; }
Property Value
Type |
---|
System.Boolean |
BaseThemeName
Gets or sets the BaseThemeName of the control.
Declaration
protected string BaseThemeName { get; set; }
Property Value
Type |
---|
System.String |
CanApplyTheme
Gets or sets a value indicating whether a
Declaration
public bool CanApplyTheme { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
CanOverrideStyle
Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.
Declaration
public bool CanOverrideStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value is false. |
Remarks
By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.
CheckBoxSelectionMode
Gets or sets the value that indicates how the items can be selected when the CheckBox is enabled in the SfListView control.
Declaration
public CheckBoxSelectionMode CheckBoxSelectionMode { get; set; }
Property Value
Type |
---|
CheckBoxSelectionMode |
CheckedItems
Gets or sets the collection containing the checked items in the SfListView control.
Declaration
public ObservableCollection<object> CheckedItems { get; set; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<System.Object> |
CheckedMember
Gets or sets the checked member for bounding the CheckBox states with datasource.
Declaration
public string CheckedMember { get; set; }
Property Value
Type |
---|
System.String |
Remarks
The CheckedMember should be in type of System.Windows.Forms.CheckState to maintain the three states of CheckBox.
ControlName
Gets the name of the control.
Declaration
public string ControlName { get; }
Property Value
Type |
---|
System.String |
CreateParams
Overridden to set the border style of the SfListView control.
Declaration
protected override CreateParams CreateParams { get; }
Property Value
Type |
---|
System.Windows.Forms.CreateParams |
Overrides
DataSource
Gets or sets the collection that is used to generate the content of the SfListView control.
Declaration
public object DataSource { get; set; }
Property Value
Type |
---|
System.Object |
DefaultSize
Gets default size of the control
Declaration
protected override Size DefaultSize { get; }
Property Value
Type |
---|
System.Drawing.Size |
DisplayMember
Gets or sets the property to display for the SfListView
Declaration
public string DisplayMember { get; set; }
Property Value
Type |
---|
System.String |
FooterControl
Gets or sets the control which is bounds to the footer item in SfListView.
Declaration
public Control FooterControl { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Control |
Remarks
The footer item control is visible only when enable the ShowHeader property.
FooterHeight
Gets or sets the height of the footer item in SfListView.
Declaration
public double FooterHeight { get; set; }
Property Value
Type |
---|
System.Double |
GroupHeaderHeight
Gets or sets the group header height of the SfListView control.
Declaration
public double GroupHeaderHeight { get; set; }
Property Value
Type |
---|
System.Double |
HeaderControl
Gets or sets the control which is bounds to the header item in SfListView.
Declaration
public Control HeaderControl { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Control |
Remarks
The header item control is visible only when enable the ShowHeader property.
HeaderHeight
Gets or sets the height of the header item in SfListView.
Declaration
public double HeaderHeight { get; set; }
Property Value
Type |
---|
System.Double |
HotTracking
Gets or sets a value indicating whether items should react on mouse hover.
Declaration
public bool HotTracking { get; set; }
Property Value
Type |
---|
System.Boolean |
ItemHeight
Gets or sets the item height value of the SfListView control.
Declaration
public double ItemHeight { get; set; }
Property Value
Type |
---|
System.Double |
ItemWidth
Gets or sets the item width of the SfListView control.
Declaration
public double ItemWidth { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
If the ItemWidth is set for the ListView, the horizontal scrollbar visibility will eb enabled for ListView if the assigned value is maximum than the SfListView control size.
Padding
Gets or sets the padding within the control.
Declaration
public Padding Padding { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Padding |
RowCount
Gets the total number rows in the SfListView control.
Declaration
public int RowCount { get; }
Property Value
Type |
---|
System.Int32 |
SelectedIndex
Gets or sets an index of the selected item in SfListView control.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
SelectedItem
Gets or sets currently selected item in the SfListView control.
Declaration
public object SelectedItem { get; set; }
Property Value
Type |
---|
System.Object |
SelectedItems
Gets or sets the collection containing the selected items in the SfListView control.
Declaration
public ObservableCollection<object> SelectedItems { get; set; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<System.Object> |
SelectionMode
Gets or sets a value that indicates how the items can be selected in the SfListView control.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
Type |
---|
System.Windows.Forms.SelectionMode |
ShowCheckBoxes
Gets or sets a value indicating whether a CheckBox can be shown for each items.
Declaration
public bool ShowCheckBoxes { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowFooter
Gets or sets a value indicating whether footer item can be shown on SfListView.
Declaration
public bool ShowFooter { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowHeader
Gets or sets a value indicating whether header can be shown on SfListView.
Declaration
public bool ShowHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowToolTip
Gets or sets a value indicating whether tool tip can be shown on item.
Declaration
public bool ShowToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
Style
Gets or sets the ListViewStyle used to customize the appearance of the SfListView control.
Declaration
public ListViewStyle Style { get; set; }
Property Value
Type |
---|
ListViewStyle |
ThemeName
Gets or sets the theme name of the SfListView control.
Declaration
public string ThemeName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value is null. |
Remarks
The theme will be applied only when the particular theme for this control has included the Themes assembly.
ToolTipOption
Gets or sets the options for the tooltip to be displayed when hovering on the item.
Declaration
public ToolTipOptions ToolTipOption { get; set; }
Property Value
Type |
---|
ToolTipOptions |
ValueMember
Gets or sets the property to use as the actual value for the items in the SfListView
Declaration
public string ValueMember { get; set; }
Property Value
Type |
---|
System.String |
VerticalScrollIncrement
Gets or sets the multiplier for vertical mouse wheel scrolling.
Declaration
public override int VerticalScrollIncrement { get; set; }
Property Value
Type |
---|
System.Int32 |
Overrides
View
Gets DataSource to keep all listview items.
Declaration
public DataSource View { get; }
Property Value
Type |
---|
DataSource |
VisualTheme
Gets or sets the visualTheme of the control, which holds the ThemeName applied from SkinManager
Declaration
protected string VisualTheme { get; set; }
Property Value
Type |
---|
System.String |
Methods
BeginInit()
Signals the object that initialization is starting.
Declaration
public void BeginInit()
BeginUpdate()
Suspends the painting of the control until the EndUpdate() method is called.
Declaration
public void BeginUpdate()
CollapseAllGroups()
Collapses all the groups in SfListView.
Declaration
public void CollapseAllGroups()
Remarks
This method collapse all the groups in SfListView programmatically.
CollapseGroup(GroupResult)
Collapses the specified group in the SfListView control.
Declaration
public void CollapseGroup(GroupResult group)
Parameters
Type | Name | Description |
---|---|---|
GroupResult | group | Specifies the GroupResult to collapse it from view. |
CreateAccessibilityInstance()
Creates a new accessibility object in SfListView.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
Type | Description |
---|---|
System.Windows.Forms.AccessibleObject | A new System.Windows.Forms.AccessibleObject for the SfListView, when AccessibilityEnabled is set as true |
Overrides
Dispose(Boolean)
overriden to dispose the events
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | To check whether should dispose happen or not |
Overrides
EndInit()
Signals the object that initialization is complete.
Declaration
public void EndInit()
EndUpdate()
Resumes the painting of the control suspended by calling the BeginUpdate() method.
Declaration
public void EndUpdate()
ExpandAllGroups()
Expands all the groups in SfListView.
Declaration
public void ExpandAllGroups()
Remarks
This method expand all the groups in SfListView programmatically.
ExpandGroup(GroupResult)
Expands the specified group in the SfListView control.
Declaration
public void ExpandGroup(GroupResult group)
Parameters
Type | Name | Description |
---|---|---|
GroupResult | group | Specifies the GroupResult to expand it from view. |
GetRowIndexAtPoint(Point)
Returns row index of the item according to the bounds.
Declaration
public int GetRowIndexAtPoint(Point point)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | point | Represents the mouse pointer |
Returns
Type | Description |
---|---|
System.Int32 | Row index |
IsInputKey(Keys)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
Declaration
protected override bool IsInputKey(Keys keyData)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Keys | keyData | One of the System.Windows.Forms.Keys values. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified key is a regular input key; otherwise, false. |
OnCreateColumnWidths()
Creates the collection for storing the column widths.
Declaration
protected virtual IPaddedEditableLineSizeHost OnCreateColumnWidths()
Returns
Type | Description |
---|---|
IPaddedEditableLineSizeHost | Returns the line size collection. |
OnCreateRowHeights()
Creates the collection for storing the row heights.
Declaration
protected virtual IPaddedEditableLineSizeHost OnCreateRowHeights()
Returns
Type | Description |
---|---|
IPaddedEditableLineSizeHost | Returns the line size collection. |
OnHorizontalScroll(ScrollEventArgs)
Overridden to calculates the offset for horizontal scrolling.
Declaration
protected override void OnHorizontalScroll(ScrollEventArgs se)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.ScrollEventArgs | se | The System.Windows.Forms.ScrollEventArgs that contains the event data. |
Overrides
OnHorizontalScrollBarValueChanged()
Overridden to perform the scrolling on the SfListView while changing the horizontal scrollbar value.
Declaration
protected override void OnHorizontalScrollBarValueChanged()
Overrides
OnLayout(LayoutEventArgs)
Overridden to update the scrollbars and the view of control.
Declaration
protected override void OnLayout(LayoutEventArgs levent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.LayoutEventArgs | levent | The System.Windows.Forms.LayoutEventArgs that contains the event data. |
OnPaint(PaintEventArgs)
Overridden to call the
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e | Provides paint data to the control. |
OnSizeChanged(EventArgs)
Overridden to update the scroll bars when the size of the control is changed.
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs that contains event data. |
Overrides
OnTouchPan(Point, Boolean)
Overridden to update the old scroll values on panning.
Declaration
protected override bool OnTouchPan(Point currentTouchPoint, bool isSwipeScroll)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | currentTouchPoint | The current touch position. |
System.Boolean | isSwipeScroll | Indicates whether to perform swipe or pan operation. |
Returns
Type | Description |
---|---|
System.Boolean | Returns false when the panning is started over the frozen rows, otherwise returns true. |
Overrides
OnVerticalScroll(ScrollEventArgs)
Overridden to calculates the offset for vertical scrolling.
Declaration
protected override void OnVerticalScroll(ScrollEventArgs se)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.ScrollEventArgs | se | The System.Windows.Forms.ScrollEventArgs that contains the event data. |
Overrides
OnVerticalScrollBarValueChanged()
Overridden to perform the scrolling on the SfListView while changing the vertical scrollbar value.
Declaration
protected override void OnVerticalScrollBarValueChanged()
Overrides
ScrollInView(Int32)
Scrolls the item into view at the specified index.
Declaration
public void ScrollInView(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Specifies the rowIndex of the row to bring into view. |
ScrollInView(Object)
Scrolls the SfListView to show the row of the defined object index
Declaration
public void ScrollInView(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | Specifies the object to bring into view |
UpdateScrollBars()
Updates the Scrollbar when perform row or column manipulation(Insert, delete, hide, adjust size, etc.).
Declaration
public override void UpdateScrollBars()
Overrides
WndProc(ref Message)
Processes Windows messages.
Declaration
protected override void WndProc(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The Windows System.Windows.Forms.Message to process. |
Overrides
Events
DrawCheckBox
Occurs while drawing the check box in the listview item.
Declaration
public event EventHandler<DrawCheckBoxEventArgs> DrawCheckBox
Event Type
Type |
---|
System.EventHandler<DrawCheckBoxEventArgs> |
DrawItem
Occurs when draw the item in SfListView control.
Declaration
public event EventHandler<DrawItemEventArgs> DrawItem
Event Type
Type |
---|
System.EventHandler<DrawItemEventArgs> |
GroupCollapsed
Occurs when a group is collapsed in SfListView control.
Declaration
public event EventHandler<GroupExpandCollapseChangedEventArgs> GroupCollapsed
Event Type
Type |
---|
System.EventHandler<GroupExpandCollapseChangedEventArgs> |
Remarks
This event occurs after the GroupCollapsing event if that event is not canceled.
See Also
GroupCollapsing
Occurs when a group is being collapsed in SfListView control.
Declaration
public event EventHandler<GroupExpandCollapseChangingEventArgs> GroupCollapsing
Event Type
Type |
---|
System.EventHandler<GroupExpandCollapseChangingEventArgs> |
Remarks
You can cancel or customize the group being collapsed through GroupExpandCollapseChangingEventArgs event argument.
See Also
GroupExpanded
Occurs when a group is expanded in SfListView control.
Declaration
public event EventHandler<GroupExpandCollapseChangedEventArgs> GroupExpanded
Event Type
Type |
---|
System.EventHandler<GroupExpandCollapseChangedEventArgs> |
Remarks
This event occurs after the GroupExpanding event if that event is not canceled.
See Also
GroupExpanding
Occurs when a group is being expanded in SfListView control.
Declaration
public event EventHandler<GroupExpandCollapseChangingEventArgs> GroupExpanding
Event Type
Type |
---|
System.EventHandler<GroupExpandCollapseChangingEventArgs> |
Remarks
You can cancel or customize the group being expanded through GroupExpandCollapseChangingEventArgs event argument.
See Also
ItemChecked
Occurs when item checked in the SfListView control.
Declaration
public event EventHandler<ItemCheckedEventArgs> ItemChecked
Event Type
Type |
---|
System.EventHandler<ItemCheckedEventArgs> |
ItemChecking
Occurs when item checking in the SfListView control.
Declaration
public event EventHandler<ItemCheckingEventArgs> ItemChecking
Event Type
Type |
---|
System.EventHandler<ItemCheckingEventArgs> |
QueryItemHeight
Occurs when item comes into view and query the item size.
Declaration
public event EventHandler<QueryItemHeightEventArgs> QueryItemHeight
Event Type
Type |
---|
System.EventHandler<QueryItemHeightEventArgs> |
SelectionChanged
Occurs when selection is changed in SfListView control.
Declaration
public event EventHandler<ItemSelectionChangedEventArgs> SelectionChanged
Event Type
Type |
---|
System.EventHandler<ItemSelectionChangedEventArgs> |
SelectionChanging
Occurs when selection is changing in SfListView control.
Declaration
public event EventHandler<ItemSelectionChangingEventArgs> SelectionChanging
Event Type
Type |
---|
System.EventHandler<ItemSelectionChangingEventArgs> |
ThemeChanged
Occurs when theme name of the
Declaration
public event EventHandler<ThemeChangedEventArgs> ThemeChanged
Event Type
Type |
---|
System.EventHandler<ThemeChangedEventArgs> |
ThemeNameChanged
Occurs when theme name of the
Declaration
public event ThemeChangedEventHandler ThemeNameChanged
Event Type
Type |
---|
ThemeChangedEventHandler |
ToolTipOpened
Occurs while showing the tooltip for the cell.
Declaration
public event EventHandler<ToolTipOpenedEventArgs> ToolTipOpened
Event Type
Type |
---|
System.EventHandler<ToolTipOpenedEventArgs> |
ToolTipOpening
Occurs while showing the tooltip for the cell.
Declaration
public event EventHandler<ToolTipOpeningEventArgs> ToolTipOpening
Event Type
Type |
---|
System.EventHandler<ToolTipOpeningEventArgs> |
Explicit Interface Implementations
IVisualStyle.VisualTheme
Gets or sets the VisualTheme of the SfListView control.
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.BaseThemeName
Gets or sets the BaseThemeName of the theme
Declaration
string IThemeProvider.BaseThemeName { get; set; }
Returns
Type |
---|
System.String |