<DataGrid Height="Auto" Width="Auto">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ItemName}" Header="Name" Width="2*" />
<DataGridTextColumn Binding="{Binding CtreateTime, StringFormat=yyyy/MM/dd HH:mm:ss}" Header="Time" Width="2*" />
<DataGridTextColumn Binding="{Binding ItemValue, StringFormat=0.0}" Header="Data" Width="*" />
<DataGridTextColumn Binding="{Binding Status}" Header="Status" Width="*"/>
</DataGrid.Columns>
</DataGrid>
Width="*", * 在这里表示一个“标准量”,前面加上数字以表示“当前列宽度在整个宽度中的权重”。
如上设置: 2*,   2*,   *,   *
总权为2+2+1+1=6,2/6即当前列宽度占DataGrid总宽度的百分比。
 
这是看过其他文章,整理了一下..

WPF---DataGrid设置列的百分比宽度 & 列值显示格式化的更多相关文章

  1. wpf datagrid设置右键菜单打开时选中项的背景色

    原文:wpf datagrid设置右键菜单打开时选中项的背景色 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/huangli321456/artic ...

  2. WPF DataGrid控件中某一列根据另一个文本列的值显示相应的模板控件

    之前做项目的时候需要实现这样一个功能.WPF DataGrid有两列,一列为"更新状态”列,一列为"值"列,如果"更新状态"列的值为“固定值更新”,则 ...

  3. WPF DataGrid中鼠标双击某一列,弹出窗体作为(增加、修改、详细)按钮的快捷键。

    跟触发器行为有关,什么是触发器什么是行为,百度其他人写的乱七八糟的,我并不能看懂.在此先强行记忆,后知后觉,再回来理解. <i:Interaction.Triggers> <i:Ev ...

  4. WPF datagrid 设置表头线与颜色、透明度

    <!--数据网格的列标题样式属性--> <DataGrid.ColumnHeaderStyle> <!--样式类型:DataGridColumnHeader(数据网格列标 ...

  5. div设置了居中和宽度,但是显示时宽度占100%

    <div id="bigDiv" align="center"> <div id="bottom" style=" ...

  6. WPF DataGrid某列使用多绑定后该列排序失效,列上加入 SortMemberPath 设置即可.

    WPF DataGrid某列使用多绑定后该列排序失效 2011-07-14 10:59hdongq | 浏览 1031 次  悬赏:20 在wpf的datagrid中某一列使用了多绑定,但是该列排序失 ...

  7. 编写 WPF DataGrid 列模板,实现更好的用户体验

    Julie Lerman 下载代码示例 最近我在为一个客户做一些 Windows Presentation Foundation (WPF) 方面的工作. 虽然我提倡使用第三方工具,但有时也会避免使用 ...

  8. ## GridView 布局:item设置的高度和宽度不起作用、自动适配列数、添加Header和Footer ##

    一.item设置的高度和宽度不起作用 转自:http://www.cnblogs.com/0616--ataozhijia/p/6031875.html [Android Pro] listView和 ...

  9. WPF DataGrid绑定一个组合列

    WPF DataGrid绑定一个组合列 前台: <Page.Resources>        <local:InfoConverter x:Key="converter& ...

随机推荐

  1. [Spark]What's the difference between spark.sql.shuffle.partitions and spark.default.parallelism?

    From the answer here, spark.sql.shuffle.partitions configures the number of partitions that are used ...

  2. jquery ajax 全局事件

    jquery的ajax方法的全部全局事件:(不管是$.ajax().$.get().$.load().$.getJSON()等都会默认触发全局事件) ajaxStart:ajax请求开始前 ajaxS ...

  3. R语言2版本3版本安装

    ./configure --prefix=/YZpath/public/software/R/R-3.5.0 --with-readline=no --with-x=no make make inst ...

  4. idea properties编码问题

    单个文件设置 全局设置default settings

  5. WebSocket 长连接 及超时问题解决

    <?phpset_time_limit(0); class SocketService { private $address = 'localhost'; private $port = 80; ...

  6. Codeforces Round #519 by Botan Investments F. Make It One

    https://codeforces.com/contest/1043/problem/F 题意 给你n个数,求一个最小集合,这个集合里面数的最大公因数等于1 1<=n<=3e5 1< ...

  7. C的指针和数组

    int i; //定义整型变量i int *p; //定义一个指向int的指针变量p int a[5]; //定义一个int数组a int *p[5]; //定义一个指针数组,其中每个数组元素指向一个 ...

  8. confluence5.65+CentOS+mysql安装破解

    以atlassian-confluence-5.6.5为例   先安装JAVA环境         通过yum安装jdk,5.6.5不支持jdk1.8,所以安装1.7或者1.6都可以         ...

  9. windows10 搭建Dubbo

    1.官方文档 http://dubbo.apache.org/zh-cn/docs/admin/ops/dubbo-ops.html 2.下载安装包 https://mirrors.cnnic.cn/ ...

  10. IntelliJ IDEA 2017版 spring-boot2.0.访问jsp页面;IDE Springboot JSp 页面访问

    1.编译器设置. 生成项目后,点击file 点开Modules 选中main,右键 选择新建文件夹 选中外部 右边添加 选中项目如图: 选好后选OK退出 webapp带点了,就是成功了,在这里建立的J ...