ListView Details View clipping text of cells after collapsing containing split panel in SplitContainer

1 Answer 44 Views
ListView SplitContainer
B
Top achievements
Rank 1
B asked on 31 May 2023, 08:06 PM

I'm using a split container to display or hide a "comment history" list view element in a details view. One column contains created DateTime values and the other contains string values of comments a user of the application left.

I use the following cell formatting event code to enable text wrapping on my cells.

private void radListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e)
        {
                e.CellElement.TextWrap = true;
        }

When the form loads everything, the cells look correct. Fully expanded and no clipped text. When I collapse the panel with the splitter buttons and "hide" the list view element and reopen the panel using the splitter buttons then the text is clipped. See attached files for reference of how I want them to look.

I've tried using RadListView.Refresh() in a dozen different event calls, RadListView.ListViewElement.Update(UpdateLayout) in a dozen different event calls, a synchronizationContext.Post() of the Refresh method in a dozen different event calls, and even direct formatting of the UI hierarchy elements Text Wrap property to true to no avail.

I have the following properties set as indicated in various tutorials for the ListView control:

  • AllowArbitraryItemHeight & ...Width = True
  • AutoSizeColumnsMode = Fill
  • Dock = Fill
  • ViewType = DetailsView

I have the following properties set for the parent SplitPanel control:

  • Dock = Fill

For other relevant properties, I can confirm on a case by case basis since I'm not sure what I'm missing in my problem. Any guidance or advice is very appreciated.

1 Answer, 1 is accepted

Sort by
1
Dinko | Tech Support Engineer
Telerik team
answered on 01 Jun 2023, 11:18 AM

Hi B Williams,

Thank you for the provided details.

 I will start with that you don't need to set the AllowArbitraryItemWidth when the AutoSizeColumnsMode is set to Fill. In this case, when Fill mode is set, the columns will try to expand to fill the available space. Setting the AllowArbitraryItemWidth property won't be relevant. 

Regarding your case, I think I was able to observe it. This is a result of using a combination of properties: AutoSizeColumnsModeAllowArbitraryItemHeight, and TextWrap. The cell is not updated correctly when the user moves the splitter. I can confirm that this is unexpected. Therefore I have logged this in our Feedback Portal on your behalf where you can track its progress and subscribe to the item so that you can be notified of its status change. As a workaround, you can update the ListViewElement by calling its InvalidateMeasure(true) and UpdateLayout() methods. You need to call this when the control is loaded and when the user moves the splitter (SplitterMoved event of the RadSplitContainer). You can check the attached project.

void UpdateListView()
{
    this.radListView1.ListViewElement.InvalidateMeasure(true);
    this.radListView1.ListViewElement.UpdateLayout();
}

Your Telerik Points are updated for bringing this behavior to our attention.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

B
Top achievements
Rank 1
commented on 01 Jun 2023, 03:09 PM

Awesome! I'm glad it wasn't an error on this users end. I sincerely appreciate the help. I'll try that workaround ASAP. If I have issues with it then I will let you know.
Tags
ListView SplitContainer
Asked by
B
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or