Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1690
Hide columns for xamGrid (MVVM)
posted

Hi,

I use xamGrid (not xamDataGrid) and I would like to hide/display some columns depending on checkbox selection. I tried to set Visibility property for column:

<ig:XamGrid ItemsSource="{Binding CountyData}" AutoGenerateColumns="False">

...

<ig:TextColumn Key="Total" Width="70" IsHideable="true"
     Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:CountyInputViewModel}},

     Path=IncludeCount, Converter={StaticResource boolToVisibilityConverter}}">

     <ig:TextColumn.HeaderTemplate>
          <DataTemplate>
              <TextBlock Text="Total" TextWrapping="Wrap" />
          </DataTemplate>
     </ig:TextColumn.HeaderTemplate

</ig:TextColumn>

where in my view model I declare public bool IncludeCount binded to checkbox and public ObservableCollection<CountyInputData> CountyData

However it does not work, columns are static. What can be wrong ?

Thanks,

Ed