如何调整Datagrid自动调整大小 [英] How to adjust Datagrid Autosizing

查看:83
本文介绍了如何调整Datagrid自动调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在我的xaml页面中使用DataGrid作为

Hello i am using DataGrid in my xaml page as

<sdk:DataGrid AutoGenerateColumns="False" Grid.Row="1" Height="400" HorizontalAlignment="Left" Margin="18,0,0,0" Name="grd_Enterprise_summary" VerticalAlignment="Top">
           </sdk:DataGrid>



在这里,我没有设置此DataGrid的宽度.

DataGrid列在运行时创建.

主要问题是,如果存储过程中的列最少出现,则DataGrid显示的很小,但我需要的是即使DataGrid仅包含一列,也要在整个页面上显示.

请为此指导我...​​..

在此先感谢



Here i dont set width of this DataGrid.

DataGrid columns are created runtime.

Main issue is this if columns appears minimum from store procedure DataGrid displayed very small but my need is even if DataGrid has a single column then also it displayed on whole page .

Please please guide me for this.....

Thanks in advance

推荐答案

This[^] might help you.


将DataColumn的width属性设置为1*,因此它们将在整个宽度上共享相同的元素.

例如

Set the width property of the DataColumn as 1*, so they will share the equal with from the entire width.

e.g

<sdk:datagridtextcolumn binding="{Binding Column1}" header="Column1" width="1*" xmlns:sdk="#unknown"></sdk:datagridtextcolumn>


Scott Morison[^]Blog also will guide you in Auto sizing the Data grid.


这篇关于如何调整Datagrid自动调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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