ListView / AutoResizeColumns with ColumnContent / inner control is LinkLabel

0
0

Hi WiseJ,

how to properly autoresize column in the listview, if the inner control of the ListviewItem is a LinkLabel? The ListView has its property View set to Wisej.Web.View.Details mode.

Consider the following code fragment, and it does not work as expected. Please advice how to do it.

*****

this.listView1.Items.Clear();

for (int i = 0; i < 32; i++)
{
var item = this.listView1.Items.Add(“”);
item.Control = new LinkLabel()
{
Text = $”label text test {i}”,
AutoSize = true
};
}

this.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

*****

 

 

 

Thank you

Pavel Weiss

  • You must to post comments
0
0

Hi Pavel,

Attached is a modified version of your sample.

Like Luca mentioned, it’s best to use HTML rather than using a LinkLabel in a ListViewItem.

You can either use regular HTML links or you can have multiple links in a single item using the “Role” attribute.

The sample include both of these approaches.

PS: for the second ListView, make sure that you click over the “roles” text to see the functionality!

HTH,
Alaa

//

  • You must to post comments
0
0

The column auto resize ColumnContent is based on the column content. It doesn’t use the item’s hosted control.

A better way to show a link in a cell is to use HTML content and handle the click.

  • Pavel Weiss
    That is sad news, as the webgui did that nicely. Could you try to add this feature for the next release?
  • Luca (ITG)
    The html link is a much better solution. WebGui leaked controls and memory left and right.
  • You must to post comments
0
0

Frank, please see attached demo project.

  • You must to post comments
0
0

Hi Pavel,

can you please wrap up a complete sample that we can run on our end?
What does “not work as expected” mean? Does it not resize at all, incorrect size, etc?

Best regards
Frank

  • Pavel Weiss
    Frank, please see attached demo project. Thanks in advance, Pavel
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.