简体   繁体   中英

How to stretch the last column of gridview

What I want to do is when I stretch the last column of the GridView, I want the width of the column and in-turn the width of the grid to extend until I let go of it. Right now, It only stretches to the max width of my screen, then i have to move the scrollbar and then extend the column again. My Column is as follows:-

<telerik:GridViewDataColumn IsGroupable="False"  Header="Mixed" ColumnGroupName="commentGroup" DataMemberBinding="{Binding MixedNotes, Mode=TwoWay}" TextWrapping="NoWrap" MinWidth="200" Width="200" CellStyle="{StaticResource ColumnTooltip}">
                                <telerik:GridViewDataColumn.HeaderCellStyle>
                                    <Style TargetType="telerik:GridViewHeaderCell" BasedOn="{StaticResource GridViewHeaderCellStyle}">

                                    </Style>
                                </telerik:GridViewDataColumn.HeaderCellStyle>

                            </telerik:GridViewDataColumn>

Hope I am clear about what I want to do.

Thank you for any help.

Well, I think this might work, basically, what you need to do is hook yourself into the events of "stretching of last column started" and "stretching of last column stopped" events.

I am not sure how you do that, but it might be as simple as subscribing to the MouseDown and MouseUp events on the grip of GridViewDataColumn .

Inside of your MouseDown and MouseUp event handlers, you need to tell that the dragging can happen outside of window too:

Mouse Move not trigger outside WPF Main Window

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM