3

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!

justin peterson
  • 367
  • 1
  • 6
  • 17
  • have you tried to apply your converter on ? – D J Nov 28 '12 at 03:42
  • I have, still nothing. I resolved the issue with code behind, I just wish I could have done it in the XAML. Actually, the code I wrote for it is a lot cleaner considering I'm using MVVM and what I wanted is for several different GridViews – justin peterson Dec 04 '12 at 18:00
  • I have described solution on my blog http://mszreder.mytechblog.pl/post/2013/10/28/Silverlight-Telerik-RadGridView-cell-visibility-depending-on-value.aspx Let me know if it is what you needed. There is no code behind, but unfortunately the grid cell template is redefined. – Mateusz Szreder Oct 28 '13 at 20:18
  • Why not just change the EveningPhone property to return an empty string when "DoNotContact" is true? – Mark Bonafe Dec 01 '14 at 16:36

1 Answers1

1

The code you provided works for me!

Alexander Vasilyev
  • 1,273
  • 2
  • 15
  • 22