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

GridView Header Property DataBinding not working

0 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
syed
Top achievements
Rank 1
syed asked on 23 May 2013, 07:04 AM
I have a RadGridView in my application which is databound to some collection in my viewmodel.
The GridView is having a header column in which I have a check box which is responsible for selecting/deselecting rows in the grid. The selection is made on the basis of the first column which is headed by the above check box(Select/Deselect All) with checkboxes with each rows.
I have a RelayCommand in my ViewModel which is expecting parameter as of the collection type as the filtered rows in the grid on the basis of anonymous filtration.
With the help of DataContexrProxy. I am able to bind my command to the command property of the Header check box(select all).

I want to pass the filtered rows as parameter to the relaycommand which I am unable to do so.

XAML Code

<telerik:RadBusyIndicator x:Name="busyCashGridView" Style="{StaticResource RadBusyIndicatorStyle1}" IsBusy="{Binding }">
                   <telerik:RadGridView x:Name="cashGridView"  Margin="0" AutoGenerateColumns="False" CanUserReorderColumns="False"  
                           CanUserSelect="False" CanUserDeleteRows="False" CanUserInsertRows="False" RowIndicatorVisibility="Collapsed"
                           ItemsSource="{Binding CashColl}" ShowColumnFooters="True"
                                        EnableColumnVirtualization="True" DataLoadMode="Asynchronous" FrozenColumnCount="2" 
                                         SelectedItem="{Binding CashSelected}" RowStyleSelector="{StaticResource RowVisible}" >
                       <telerik:RadGridView.Resources>
                           <RV:DataContextProxy x:Key="DataContextProperty" />
                       </telerik:RadGridView.Resources>
                       <telerik:RadGridView.Columns>
                           <telerik:GridViewColumn IsReadOnly="False" UniqueName="Select" IsVisible="True">
                               <telerik:GridViewColumn.Header>
                                   <CheckBox x:Name="chkSelectHeader"
                                             Command="{Binding Source={StaticResource DataContextProperty},Path=DataContext.ChkAllCash}"
CommandParameter="{Binding ElementName=cashGridView,Path=ItemsSource}" />
 
                               </telerik:GridViewColumn.Header>
 
                               <telerik:GridViewColumn.CellTemplate>
                                   <DataTemplate>
                                       <CheckBox x:Name="chkSelect" IsChecked="{Binding Model.Post, Mode=TwoWay}" IsEnabled="{Binding IsEnabled}" />
                                   </DataTemplate>
                               </telerik:GridViewColumn.CellTemplate>

Please advise.

Regards,
Zafar

No answers yet. Maybe you can help?

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