multiline – Owl's Blog on .NET development http://www.componentowl.com/blog Component Owl codes Better ListView control all night so you don't have to. Tue, 04 Sep 2018 13:10:05 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.8 How To: Dynamically Resize Focused Item http://www.componentowl.com/blog/how-to-dynamically-resize-focused-item/ http://www.componentowl.com/blog/how-to-dynamically-resize-focused-item/#respond Thu, 22 Dec 2011 02:29:35 +0000 http://www.componentowl.com/blog/?p=468 Better ListView 2.4.0 now supports setting MaximumTextLines property on every item and sub-item, so you can have multi-line items each with different number text lines:

Dynamic resizing of the focused item

Dynamic resizing of the focused item

We also introduced FocusedItemChanged event, so that you can detect when focus has moved from one element (item / sub-item / group) to another.

These features can be combined to display only the focused item with more details to save space code of the FocusedItemChanged event handler may look like this:

C#

[csharp gutter=”false” toolbar=”false”]
void ListViewFocusedItemChanged(object sender, BetterListViewFocusedItemChangedEventArgs eventArgs)
{
BetterListView listView = (BetterListView)sender;

listView.BeginUpdate();

if (eventArgs.FocusedItemOld != null)
{
// set single line of text for currenly unfocused item
eventArgs.FocusedItemOld.MaximumTextLines = 1;
}

if (eventArgs.FocusedItemNew != null)
{
// set three lines of text for currenly focused item
eventArgs.FocusedItemNew.MaximumTextLines = 3;
}

listView.EndUpdate();
}
[/csharp]

Visual Basic

[vb gutter=”false” toolbar=”false”]
Sub ListViewFocusedItemChanged(sender As Object, eventArgs As BetterListViewFocusedItemChangedEventArgs)
Dim ListView As BetterListView = DirectCast(sender, BetterListView)

ListView.BeginUpdate()

If eventArgs.FocusedItemOld IsNot Nothing Then
‘ set single line of text for currenly unfocused item
eventArgs.FocusedItemOld.MaximumTextLines = 1
End If

If eventArgs.FocusedItemNew IsNot Nothing Then
‘ set three lines of text for currenly focused item
eventArgs.FocusedItemNew.MaximumTextLines = 3
End If

ListView.EndUpdate()
End Sub
[/vb]

]]>
http://www.componentowl.com/blog/how-to-dynamically-resize-focused-item/feed/ 0
Displaying Multi-Line Text In ListView http://www.componentowl.com/blog/displayingmultiline-items-in-listview/ http://www.componentowl.com/blog/displayingmultiline-items-in-listview/#respond Thu, 24 Nov 2011 16:42:44 +0000 http://www.componentowl.com/blog/?p=450 Multi-Line text has been supported since Better ListView 2.0 (as automatic text-wrapping with configurable number of Maximum Text Lines), but we enhanced this feature inversion 2.3.2 by adding support for “hardcoded” newline characters (LF) in item text:

Items with multi-line text

Items with multi-line text

Column headers and even groups can contain multi-line text:

Multi-line text in groups

Multi-line text in groups

So the text can be split on multiple lines not only by wrapping the text, but also by user defined newline characters.

This feature comes out of the box.

The only setting associated with multi-line items is the MaximumTextLines property of the corresponding layout (e.g. BetterListView.LayoutItemsLargeIcon). This property specifies how many lines the text can have and this applies to both wrapped text and text with newline characters. So if you expect you text to have 5 to 20 lines, set the MaximumTextLines property to 20 and you know the items will not get too high while still displaying all the lines.

Multi-line text is supported on column headers, items, sub-items and groups.

Download the latest Better ListView

]]>
http://www.componentowl.com/blog/displayingmultiline-items-in-listview/feed/ 0
Better ListView 2.00 released http://www.componentowl.com/blog/better-listview-2-00-released/ http://www.componentowl.com/blog/better-listview-2-00-released/#respond Sun, 31 Jul 2011 15:25:39 +0000 http://www.componentowl.com/blog/?p=304 A new major version of Better ListView has been released! Download the new version.

Item hierarchy with multi-line items in groups

Item hierarchy with multi-line items in groups

Summary of what’s new:

We have added four new major features:

  • Groups – items can be organized in collapsible groups
  • Item Hierarchy – items can be organized in a tree structure, can be also collapsed just like the nodes in a TreeView
  • Multi-Line Items – item texts can break in several lines and each item can have different size
  • Data Binding – complex data binding is fully supported, any List, DataTable, DataView, array or any other IList-type object can be bound to Better ListView as a data source

Many existing features of Better ListView has been enhanced in favor of these. For example:

  • Item reordering can be done with hierarchical items as well; user can even create child items
  • It is possible to move items between different groups

Some of the minor features added are:

  • Layouts can be adjustable – item sizes and spacings, even internal spacings
  • Added new label editing controls (calendar and drop down box)
  • Better ListView content (columns, items and groups) can be saved to file (XML or binary)
  • Multi-line items support added
  • See full changelog for details

We have also fixed many issues and improved performance of Thumbnails view and operations with collections.

About then new version

The new version 2.00 brings new major features, the most important one being item hierarchy support. This allows you to create tree-list structures in the list view, without having to sacrifice any of the list view functionality (columns, sorting, grouping, Drag and Drop reordering, etc).

Highly customizable item grouping capabilities were added. Individual group headers can have customized look and behavior. The group headers can be collapsible, support images, custom context menus, are focusable, and more.

Version 2.0 also improves the thumbnail view. The control handles larger images smoothly, even while resizing.

List items, group headers and column header can newly have custom padding specified for all of their elements, which makes it easy to do owner drawing of custom elements, such as overlay icons in the thumbnail view. Every part of the control can be newly replaced by custom drawing, not just overdrawn.

Version 2.0 newly allows you to save/load the list view contents with 1 just line of code, either in XML or binary format, to either file or string. Data-binding with custom column-mapping is supported as well.

Multi-line listview items are also newly supported. List items with very long text can take place of two (r more) regular items, so the text whole text is readable.

Better ListView 2

Thumbnails in groups

DataTable bound to Better ListView

DataTable bound to Better ListView

Other news – new comics for developers!

We’ve also started publishing new webcomics for developers on our website, drawn by the Better ListView lead developer, Libor Tinka.

]]>
http://www.componentowl.com/blog/better-listview-2-00-released/feed/ 0