[英]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. 我想要做的是,当我拉伸GridView的最后一列时,我想要该列的宽度,然后依次扩展网格的宽度,直到我放开它为止。 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
. 我不知道如何做到这一点,但是它可能就像订阅GridViewDataColumn
上的MouseDown
和MouseUp
事件一样简单。
Inside of your MouseDown
and MouseUp
event handlers, you need to tell that the dragging can happen outside of window too: 在MouseDown
和MouseUp
事件处理程序内部,您需要告知拖动也可能发生在窗口之外:
Mouse Move not trigger outside WPF Main Window WPF主窗口外不会触发鼠标移动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.