namespace X10D.WinForms
{
#region Using Directives
using System.Windows.Forms;
#endregion
///
/// A set of extension methods for and .
///
public static class ListViewExtensions
{
///
/// Moves the to the top of the specified .
///
/// The to move.
/// Optional. The parent . Defaults to the current parent.
public static void MoveToTop(this ListViewItem item, ListView listView = null)
{
if (listView == null)
{
listView = item.ListView;
}
if (listView.Items.Contains(item))
{
int i = listView.Items.IndexOf(item);
listView.Items.RemoveAt(i);
}
listView.Items.Insert(0, item);
}
}
}