WPF Hide DataGridColumn via a binding
        Posted  
        
            by Greg R
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Greg R
        
        
        
        Published on 2010-03-25T18:56:31Z
        Indexed on 
            2010/03/25
            20:23 UTC
        
        
        Read the original article
        Hit count: 729
        
For some reason I can't hide WPF Toolkit's DataGridColumn. I am trying to do the following:
<dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}">
<dg:DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
        <TextBox Text="{Binding Path=ItemDescription}" />
    </DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
This doesn't work, since it's looking for a IsReadOnly property on the ItemSource (not a property of the current class). If add this as a property of the ItemSource class that implements INoifyPropertyChanged, it still doesn't hide the column. Is there a way around this? I want the column to hid when a button click changes IsReadOnly property.
Assume IsReadOnly returns a Visibility value and is a dependency property
I am completely stuck, I would really appreciate the help! Thanks a lot!
© Stack Overflow or respective owner