Files
componentowl-astro/public/documentation/better-listview-express/data/chapter-sub-items.html

100 lines
4.9 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Sub-items</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="prettify.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="prettify.js"></script><script type="text/javascript" src="lang-vb.js"></script><link href="../resources/main.css" media="screen" rel="stylesheet" type="text/css">
</head>
<body onload="prettyPrint()"><div class="placing">
<br><table class="navigation"><tr>
<td class="navigation-previous"><a href="chapter-sort.html"><strong>
« Sorting Items</strong></a></td>
<td class="navigation-index"><a href="../../../better-listview-express/documentation.html"><strong>Index</strong></a></td>
<td class="navigation-next"><a href="chapter-text-formatting.html"><strong>Text Formatting »
</strong></a></td>
</tr></table>
<br><h1>Sub-items</h1>
<div class="banner">
<a href="../../../blog/page/6/index.html"><img src="../resources/overview.gif" alt="Better ListView" class="ss"></a>
<div class="inside">
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterlistview.exe" class="dbtn">Download</a></span></span>
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../blog/page/6/index.html" class="dbtn">More Info</a></span></span>
</div>
</div>
<p>Every item within the list view can contain sub-items. These can be
accessed using <span class="code">BetterListViewItem.SubItems</span> collection.</p>
<p>Sub-items are displayed only in the <strong><em>Details</em></strong> view
when the columns are present. Each item can have any number of sub-items,
but the number of sub-items displayed is limited by the number of column
headers.</p>
<p>The following screenshot shows Better ListView with items and
sub-items displayed on the right of each items (in columns) with one
sub-item being focused (see <strong><em><a href="chapter-focus.html">Focusing
Elements</a></em></strong> for more information):</p>
<p class="images"><img src="sub-items.png"></p>
<h2>Copying sub-items</h2>
<p>The sub-item collection behaves differently than other collections
present in Better ListView.</p>
<p>It always have to contain at least one sub-item. Even if you call
<span class="code">Clear</span> method, one sub-item remains in the collection. This is
because this sub-item represents properties of the item itself.</p>
<p>To copy sub-items from one item to another, you have to consider
<strong><em>setting</em></strong> the first sub-item, while adding the
other:</p>
<p><strong>C#</strong></p>
<pre class="prettyprint"><code class="lang-cs">itemTarget.SubItems[0] = (BetterListViewSubItem)itemSource.SubItems[0].Clone();
for (int indexSubItem = 1; indexSubItem &lt; itemSource.SubItems.Count; indexSubItem++)
{
itemTarget.SubItems.Add((BetterListViewSubItem)itemSource.SubItems[indexSubItem].Clone());
}</code></pre>
<p><strong>Visual Basic</strong></p>
<pre class="prettyprint"><code class="lang-vb">itemTarget.SubItems(0) = DirectCast(itemSource.SubItems(0).Clone(), BetterListViewSubItem)
For indexSubItem As Integer = 1 To itemSource.SubItems.Count - 1
itemTarget.SubItems.Add(DirectCast(itemSource.SubItems(indexSubItem).Clone(), BetterListViewSubItem))
Next</code></pre>
<br><div class="banner">
<a href="../../../blog/page/6/index.html"><img src="../resources/overview.gif" alt="Better ListView" class="ss"></a>
<div class="inside">
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterlistview.exe" class="dbtn">Download</a></span></span>
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../blog/page/6/index.html" class="dbtn">More Info</a></span></span>
</div>
</div>
<table class="navigation"><tr>
<td class="navigation-previous"><a href="chapter-sort.html"><strong>
« Sorting Items</strong></a></td>
<td class="navigation-index"><a href="../../../better-listview-express/documentation.html"><strong>Index</strong></a></td>
<td class="navigation-next"><a href="chapter-text-formatting.html"><strong>Text Formatting »
</strong></a></td>
</tr></table>
<br><table class="footer"><tr>
<td class="footer-title">Better ListView Express Documentation
</td>
<td class="footer-copyright">
Copyright © <a href="../../../index.html" target="_blank">ComponentOwl.com</a>
</td>
</tr></table>
</div></body>
</html>