Context: a C# 4.0 WPF application with a datagrid that has one TemplateColumn showing a progress bar.
How can one get the grid to only display the progress bar for certain items based on a condition?
Maybe listening to the events and hiding the cells / setting visibile to false would be an option.
This is how it looks right now (the progress bar is shown for all items):
<UserControl.Resources>
<DataTemplate x:Key="PotentialDataTemplate">
<Grid Width="70">
<ProgressBar
Height="12"
VerticalAlignment="Center"
Value="{Binding Path=Potential, Mode=OneWay}" />
</Grid>
</DataTemplate>
</UserControl.Resources>
<DataGrid x:Name="dataGrid"
ItemsSource="{Binding Path=Items}"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTemplateColumn
Header="{Binding Source={x:Static text:TextBindingProvider.Instance}, Path=CompendiumHeaderPotential}"
Width="Auto"
MinWidth="80"
CellTemplate="{StaticResource PotentialDataTemplate}"
IsReadOnly="true"
SortMemberPath="Potential" />
</DataGrid.Columns>
</DataGrid>