namespace Yw.WinFrmUI { /// /// /// public static class ListBoxControlExtensions { /// /// /// public static void InitialDefaultSettings(this ListBoxControl listBox, int ItemHeight = 25) { listBox.ShowFocusRect = false; listBox.ItemHeight = ItemHeight; } /// /// 获取当前数据行 /// public static T GetCurrentViewModel(this ListBoxControl listBox, IEnumerable source) where T : class { if (source == null) return default; if (source.Count() < 1) { return default; } var row = listBox.SelectedItem as T; if (row == null) { return null; } return row; } } }