Gridview ColumnHeader

1 posts, 0 answers
  1. gisela
    gisela avatar
    15 posts
    Member since:
    Feb 2006

    Posted 29 Jan 2013 Link to this post

    Hi,
    i'm using the following xaml:

    <telerik:RadGridView x:Name="Grid" AutoGenerateColumns="False" ItemsSource="{Binding GridDataPoints}"

     SelectedItem="{Binding SelectedDay, Mode=TwoWay}"

     FrozenColumnCount="3" >

     <telerik:RadGridView.Columns>

     <telerik:GridViewDataColumn Width="90" DataMemberBinding="{Binding Ist.TimeRange.Start, StringFormat=\{0:dd.MM.yyyy\}}" CellStyle="{StaticResource TextCell}">

     <telerik:GridViewColumn.HeaderCellStyle>

     <Style TargetType="telerik:GridViewHeaderCell" BasedOn="{StaticResource HeaderCellLeft}">

     <Setter Property="ContentTemplate">

     <Setter.Value>

     <DataTemplate>

     <TextBlock Text="{Binding DataContext.ColumnHeaderDate, ElementName=LayoutRoot}" />

     </DataTemplate>

    </Setter.Value>

     </Setter>

     </Style>

     </telerik:GridViewColumn.HeaderCellStyle>

    ...

    All works fine, but I want bind another control to the columns header, so the user can change the visibility of columns:

     

     

     

    <Border Margin="8">

     <ListBox ItemsSource="{Binding Columns}" Background="Transparent" Style="{StaticResource ListBoxStyle}" Foreground="White" Margin="8" >

     <ListBox.ItemTemplate >

     <DataTemplate>

     <CheckBox Content="{Binding Header}"

     IsChecked="{Binding IsVisible, Mode=TwoWay}" />

     </DataTemplate>

    </ListBox.ItemTemplate>

     </ListBox>

     </Border>

    The listbox displays not the bound value of 'DataContext.ColumnHeaderDate', it displays 'Ist.TimeRange.Start'.
    How can i bind the Checkbox to display the value of 'DataContext.ColumnHeaderDate' ?

     

     

     

     Thanks in advance

Back to Top