如何过滤数组属性中的数据以便在xaml中进行绑定

时间:2015-11-24 21:56:21

标签: c# arrays xaml properties

我有一个包含以下字段的课程:

public byte[] myByteArray;

我在ListView中绑定数组的值:

<GridViewColumn DisplayMemberBinding="{Binding myByteArray[1]}" />
<GridViewColumn DisplayMemberBinding="{Binding myByteArray[2]}" />
...

如果数组中的元素为零,如何将条目留空?

Pseudocode: if(myByteArray[indexValue] == 0) display nothing in ListView

提前致谢,

1 个答案:

答案 0 :(得分:0)

我可能在这里遗漏了一些东西,但要将ListView设为空白,请将其设置为null。

if(myByteArray[indexValue]==0)
   listView=null;

要使特定项目为空,请将该特定项目设置为null。比如

listView.Items.GetItemAt(index)=null;