Linux Silverlight 和 DataGridColumn 类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3677149/
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
Silverlight and DataGridColumn type
提问by Jhelumi
I have a datagrid with DataGridTemplateColumn and DataGridTextColumn in it. In my backend code I'm looping thru the datagrid.Columns Collections to see if the column has a binding or not. I need to know How can I determine if the Columns type is of DataGridBoundColumn or NOT?? Any ideas which method/property does that.
我有一个包含 DataGridTemplateColumn 和 DataGridTextColumn 的数据网格。在我的后端代码中,我循环遍历 datagrid.Columns 集合以查看该列是否具有绑定。我需要知道如何确定 Columns 类型是 DataGridBoundColumn 还是 NOT ?任何方法/属性可以做到这一点的想法。
回答by Jhelumi
Found the answer:
找到答案:
foreach (DataGridColumn col in this.Columns)
{ if (col is DataGridBoundColumn) { DataGridBoundColumn = column = col as DataGridBoundColumn; } }
{ if (col is DataGridBoundColumn) { DataGridBoundColumn = column = col as DataGridBoundColumn; } }