如何让 XAML DataGridColumns 填充整个 DataGrid? [英] How do I make XAML DataGridColumns fill the entire DataGrid?

查看:21
本文介绍了如何让 XAML DataGridColumns 填充整个 DataGrid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 XAML(不是 Silverlight)中使用 DataGrids 和可调整大小的列,如果用户调整屏幕大小,DataGrid 将扩展.

I am using DataGrids in XAML (not Silverlight) with resizable columns, the DataGrid will expand if the user resizes the screen.

目前,如果所有 DataGrid 列的宽度都小于 DataGrid 的宽度,我会出现一个额外的列",该列不可点击且无用.

Currently if the widths of all the DataGrid columns are less than the width of the DataGrid I get an extra "column" appearing which is unclickable and serves no purpose.

有谁知道如何使一列始终调整大小以填充所有剩余空间?

Does anyone know how to make one column always resize to fill all the remaining space?

推荐答案

如果您使用 Width="*" 列将填充以扩展可用空间.

If you use Width="*" the column will fill to expand the available space.

如果您希望所有列均等地划分网格,请将其应用于所有列.如果您只想填充剩余空间,只需将其应用于该列,其余为自动"或特定宽度.

If you want all columns to divide the grid equally apply this to all columns. If you just want one to fill the remaining space just apply it to that column with the rest being "Auto" or a specific width.

如果您希望列占据可用宽度的 1/4,您也可以使用 Width="0.25*"(例如).

You can also use Width="0.25*" (for example) if you want the column to take up 1/4 of the available width.

这篇关于如何让 XAML DataGridColumns 填充整个 DataGrid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆