wpf 如何让 DevExpress GridControl 列填充网格中的剩余空间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19587431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I make a DevExpress GridControl column fill remaining space in the grid?
提问by ProfK
I have a GridControlwhere the first column is "Name", whose width I need to be variable, followed by several other columns whose width remains constant. If I was using the Telerik DataGridView, I would set the column width to *, but the DevExpress control doesn't allow that for the column width. It has no converter.
我有一个GridControl第一列是“名称”,其宽度我需要可变,然后是其他几个宽度保持不变的列。如果我使用 Telerik DataGridView,我会将列宽设置为*,但 DevExpress 控件不允许将列宽设置为 。它没有转换器。
When the grid expands or contracts horizontally, I need the "Name" column to do the same, proportionately. Do I have to do this in code-behind? I really like my WPF basic CRUD to use as little code as possible.
当网格水平扩展或收缩时,我需要“名称”列按比例进行相同的操作。我必须在代码隐藏中执行此操作吗?我真的很喜欢我的 WPF 基本 CRUD 使用尽可能少的代码。
How do I achieve this?
我如何实现这一目标?
回答by Luke94
I haven't used DevExpress for a while, but I think you can use for your 'Name' Column GridColumn.BestFit
我有一段时间没有使用 DevExpress,但我认为您可以将GridColumn.BestFit用于您的“名称”列
For the rest, you can use FixedWidth
其余的,您可以使用FixedWidth

