<p>可以使用以下代码获取ListView的ItemsSource数组长度:</p>
<pre><code class="language-csharp">int count = listView.ItemsSource.Cast&lt;object&gt;().Count();
</code></pre>
<p>这里使用了ItemsSource的Cast方法将其转换为IEnumerable<object>,然后使用Count方法获取其长度。</p>
C# WPF ListView ItemsSource 获取数组长度

原文地址: http://www.cveoy.top/t/topic/hr47 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录