justin peterson
justin peterson

Reputation: 377

How do I hide a cell in a RadGridView depending on the current object's bool property?

I currently have a list of objects in which my RadGridView's ItemsSource is set to. When the property "DoNotContact" of the object in the list has been set to True, I want to hide the information in the cell that contains a Phone number within my RadGridView. As you can see in my XAML, I'm setting the Visibility property within the TextBlock like so:

            <telerik:GridViewDataColumn Header="Evening" DataMemberBinding="{Binding Path=EveningPhone}" Width="75" SortMemberPath="EveningPhone">
                 <telerik:GridViewColumn.CellTemplate>
                    <DataTemplate>
                       <TextBlock Visibility="{Binding Path=DoNotContact, Converter={StaticResource BoolToVisibilityConverter}}">
                          <Hyperlink Click="MakeEveningCallHandler">
                             <TextBlock Text="{Binding Path=EveningPhone}" />
                          </Hyperlink>
                       </TextBlock>
                    </DataTemplate>
                 </telerik:GridViewColumn.CellTemplate>
              </telerik:GridViewDataColumn>

When attempting to debug it, the Converter is never hit and although I can see the property "DoNotContact" has been set, the phone number still shows. The converter itself works fine as I've used it in other occasions. Again I only want to hide the information WITHIN the cell for the "Evening" Property, not the actual column itself. Any Ideas what's going wrong here? Thanks a bunch!

Upvotes: 3

Views: 1183

Answers (1)

Alexander Vasilyev
Alexander Vasilyev

Reputation: 1313

The code you provided works for me!

Upvotes: 1

Related Questions