Files
componentowl-astro/public/documentation/better-listview-express/data/chapter-item-reorder.html

212 lines
8.3 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>Item Reordering</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-item-hierarchy.html"><strong>
« Item Hierarchy</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-items.html"><strong>Items »
</strong></a></td>
</tr></table>
<br><h1>Item Reordering</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>
<br><hr>
<p class="note">Item reordering is not supported in <strong><em>Better ListView
Express</em></strong>.</p>
<hr>
<br><p class="images"><img src="item-reorder.png"></p>
<p>Changing item order by dragging items can be turned on by setting
<span class="code">ItemReorderMode</span> to one of the following values:</p>
<ul style="list-style:none">
<li>
<span class="code">Disabled</span><ul style="list-style:none"><li>
<p>Item reordering is disabled (default value).</p>
</li></ul>
</li>
<li>
<span class="code">Enabled</span><ul style="list-style:none"><li>
<p>Item reordering is enabled and automatic.</p>
</li></ul>
</li>
<li>
<span class="code">Custom</span><ul style="list-style:none"><li>
<p>Item reordering is enabled, but the actual reordering is up to
the user.</p>
</li></ul>
</li>
</ul>
<p>The reordering is realized through Drag and Drop mechanism.</p>
<p>Item reordering can supports groups and item hierarchy.</p>
<p>Target location of reordered items is displayed using <strong><em><a href="chapter-insertion-mark.html">Insertion mark</a></em></strong>. If the
reordering cannot be performed (e.g. when inserting item between its own
children), then the insertion mark is displayed as disabled and the
reordering will not be performed.</p>
<h2>Reordering Options</h2>
<p>There are several item reordering options to adjust the feature for
working with groups and hierarchical items. These options can be used as
flags of the enumm property <span class="code">ItemReorderOptions</span>:</p>
<ul style="list-style:none">
<li>
<span class="code">AllowCreateChild</span><ul style="list-style:none"><li>
<p>Allow creating a child items by inserting item into another
item without children.</p>
</li></ul>
</li>
<li>
<span class="code">AutoCollapse</span><ul style="list-style:none"><li>
<p>Collapse item with children prior to reordering.</p>
</li></ul>
</li>
<li>
<span class="code">KeepGroups</span><ul style="list-style:none"><li>
<p>Do not change item groups when reordering.</p>
</li></ul>
</li>
<li>
<span class="code">KeepItemHierarchy</span><ul style="list-style:none"><li>
<p>Keep parent-child item relations when reordering.</p>
</li></ul>
</li>
<li>
<span class="code">None</span><ul style="list-style:none"><li>
<p>No options are active.</p>
</li></ul>
</li>
<li>
<span class="code">SameParentOnly</span><ul style="list-style:none"><li>
<p>Allow reordering items with same parent item only.</p>
</li></ul>
</li>
</ul>
<p>None of the extra options are on by default so the default value is
<span class="code">ItemReorderOptions.None</span>.</p>
<h2>Auto-Expansion Checking</h2>
<p>Auto expansion checking is performed during item reordering and
looks whether it is valid to auto expand item over which mouse cursor
hovers. By default, there is only one situation when auto expansion is not
allowed: Item which is auto-collapsed will not be than auto-expanded
again.</p>
<p>It is possible to add custom checking (e.g. when some items or
groups should not expand when user drags items over it) by handling
<span class="code">CheckAutoExpand</span> event and than set
<span class="code">BetterListViewCheckAutoExpandEventArgs.IsValid</span> to
<span class="code">false</span> whenever you want to deny auto-expansion. Event data
contains both source and target items.</p>
<h2>Item Reordering Checking</h2>
<p>Item reorder checking is performed during item reordering and looks
whether an item is not put into itself (into its own children). For
example, when <span class="code">AllowCreateChild</span> reordering option is enabled,
then the check looks whether user is not making child item under the
reordered item.</p>
<p>It is possible to add custom checking (e.g. when item should not be
placed some specific locations with item reordering) by handling
<span class="code">CheckItemReorder</span> event and then set
<span class="code">BetterListViewCheckItemReorderEventArgs.IsValid</span> to
<span class="code">false</span>. Event data contains source items, target location and
current reordering options.</p>
<h2>Sample Source Code</h2>
<p><strong>C#</strong></p>
<pre class="prettyprint"><code class="lang-cs">this.listView.BeginUpdate();
this.listView.Columns.Add("column");
this.listView.Items.AddRange(
new[]
{
"first item",
"second item",
"third item",
"fourth item",
"fifth item"
});
// enable item reordering
this.listView.ItemReorderMode = BetterListViewItemReorderMode.Enabled;
this.listView.EndUpdate();</code></pre>
<p><strong>Visual Basic</strong></p>
<pre class="prettyprint"><code class="lang-vb">ListView.BeginUpdate()
ListView.Columns.Add ("column")
ListView.Items.AddRange (
New String() { _
"first item",
"second item",
"third item",
"fourth item",
"fifth item"
})
' enable item reordering
ListView.ItemReorderMode = BetterListViewItemReorderMode.Enabled
ListView.EndUpdate()</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-item-hierarchy.html"><strong>
« Item Hierarchy</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-items.html"><strong>Items »
</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>