绑定DataGridTextColumn标头

编程入门 行业动态 更新时间:2024-10-23 18:30:01
本文介绍了绑定DataGridTextColumn标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想根据我背后的代码中的变量数组动态更新/设置DataGridTextColumn标头. 我背后的代码中.

I want to dynamically update/set the DataGridTextColumn header based on variable array in my code behind.In my code behind.

;私有列表< int>年; 公共列表< int>年份 {得到 {返回年份; } 设置 {年=值; RaisePropertyChanged(年份"); } } 在我的xaml文件中,我有一个数据网格,我想在其中设置列上的标题 < toolkit:DataGrid ItemsSource =" {绑定价格}" AutoGenerateColumns =假"> < toolkit:DataGrid.Columns> &b < toolkit:DataGridTextColumn Binding =< {Binding Gloves}";> &bsp; ; < toolkit:DataGridTextColumn.Header> nbsp; b <标签内容="{绑定年份[0]}"/> ; </toolkit:DataGridTextColumn.Header> b ; </toolkit:DataGridTextColumn> </toolkit:DataGrid.Columns> </toolkit:DataGrid> 似乎不起作用,标题为空(未显示任何内容)-如果我更改Content =" {Binding Years [0]}"" to Content ="2010"然后标题显示2010 有什么建议吗?提前thx

推荐答案

MrCoderMan, -><标签内容=" {绑定年[0]}"/> 您是否尝试过在上面的绑定中应用值转换器而不设置绑定路径?因此,在后面的代码中,您可以在Convert方法中检查value参数.如果您仍然无法解决问题,我会看一下并对其进行修复. 谢谢.此致. Hi MrCoderMan,--><Label Content="{Binding Years[0]}"/>Have you tried applying a value converter in the binding above without setting binding path? So in the code behind, you can check thevalue parameter inthe Convert method. If you still can not figure it out, I will see to this and repro it.Thanks.Sincerely.

更多推荐

绑定DataGridTextColumn标头

本文发布于:2023-11-03 12:46:43,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   DataGridTextColumn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!