I have listview with 10 GridViewColumn
s, each column should be visible at runtime based on a condition, of course the column can be collapsed by setting the width to 0. but how to do this programaticaly let say if P[1].TestResult = "NA"
then the column should collapsed.
<GridViewColumn Width="50" Header="P-1">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock x:Name="P1" Text="{Binding P[1].TestResult}" TextAlignment="Center" FontSize="20" Style="{StaticResource CellStyle}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="50" Header="P-2">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock x:Name="P2" Text="{Binding P[2].TestResult}" TextAlignment="Center" FontSize="20" Style="{StaticResource CellStyle}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<!-- ... -->