wpf icon indicating copy to clipboard operation
wpf copied to clipboard

Disable WPF Listview Column Resizing

Open vsfeedback opened this issue 1 year ago • 1 comments

This issue has been moved from a ticket on Developer Community.


Add a property to prevent resizing of a column in a WPF Listview but still make it sortable.

There is one way around this, but it disables sorting on that column.


Original Comments

Feedback Bot on 12/1/2022, 08:40 AM:

(private comment, text removed)

vsfeedback avatar Jul 16 '24 06:07 vsfeedback

I don't think that is a good practice and some effort should be required on the developer side to enforce this.

The effort is pretty minimal anyway:

public class NonResizableGridViewColumnHeader : GridViewColumnHeader
{
    public override void OnApplyTemplate()
    {
        if (Role != GridViewColumnHeaderRole.Normal)
            base.OnApplyTemplate();
    }
}

miloush avatar Jul 16 '24 18:07 miloush