From ca5f300a7cef85d22b5e0f9d59d117c49f9909b3 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期二, 19 十一月 2024 09:42:16 +0800
Subject: [PATCH] 完善资产界面

---
 WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs b/WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs
index 14a4f0c..693cd87 100644
--- a/WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs
@@ -1,17 +1,36 @@
 锘縩amespace Yw.WinFrmUI
 {
     /// <summary>
-    /// 
+    ///
     /// </summary>
     public static class ListBoxControlExtensions
     {
         /// <summary>
-        /// 
+        ///
         /// </summary>
         public static void InitialDefaultSettings(this ListBoxControl listBox, int ItemHeight = 25)
         {
             listBox.ShowFocusRect = false;
             listBox.ItemHeight = ItemHeight;
         }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠鏁版嵁琛�
+        /// </summary>
+        public static T GetCurrentViewModel<T>(this ListBoxControl listBox, IEnumerable<T> 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;
+        }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3