I am implementing a custom control which derives from ListView.
I would like for the final column to fill the remaining space (Quite a common task), I have gone abou
I know this is old question, but after reading this and then finding my own answer, I thought I would share for others reading this as well.
The fix for me (so far holding up under basic testing) was to set Docked to None and just Anchor my ListView to the top-left of the parent. Then, in the OnClientSize changed of the parent I set the size of my ListView to fill it, and then set my column width. For whatever reason, probably timing, this fixed the scrollbar issue mentioned by the original question.
private void ContentSplit_Panel1_ClientSizeChanged(object sender, EventArgs e)
{
CaseFilter.Bounds = ContentSplit.Panel1.ClientRectangle;
if(CaseFilter.Columns.Count == 1)
CaseFilter.Columns[0].Width = CaseFilter.ClientRectangle.Width;
}
CaseFilter is my ListView and ContentSplit.Panel1 is a SplitContainer control it is inside. When I had it set to Dock=Fill, I had the scrollbar issue, with the above changes, no problems.