This is a migrated thread and some comments may be shown as answers.

Gridview ColumnHeader

0 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
gisela
Top achievements
Rank 1
gisela asked on 29 Jan 2013, 02:54 PM
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

No answers yet. Maybe you can help?

Tags
GridView
Asked by
gisela
Top achievements
Rank 1
Share this question
or