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

check/uncheck all check-boxes in column

2 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
RoxanaC
Top achievements
Rank 1
RoxanaC asked on 06 May 2010, 10:15 AM
Hello!

I'm not sure what I'm missing here.
I have a RadGridView with the following structure:

            <Controls:RadGridView x:Name="radGridView" 
                                  ScrollMode="RealTime" 
                                  ShowGroupPanel="False" 
                                  CanUserReorderColumns="False" 
                                  CanUserDeleteRows="False" 
                                  CanUserInsertRows="False" 
                                  Grid.Row="1" 
                                  ItemsSource="{Binding Metadata}" 
                                  AutoGenerateColumns="False" 
                                  ShipMonitoring:DataInfoHeaderMenu.IsEnabled="True"
                <Controls:RadGridView.Columns> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding Name}" 
                                                 Header="Symbol" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding ClearName}" 
                                                 Header="Name" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding Description}" 
                                                 Header="Description" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding Source}" 
                                                 Header="Source" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding Unit}" 
                                                 Header="Unit" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn DataMemberBinding="{Binding Category}" 
                                                 Header="Category" 
                                                 IsReadOnly="True" /> 
                    <Controls:GridViewDataColumn Header="Select " 
                                                 IsReadOnly="True" 
                                                 DataMemberBinding="{Binding Used}"
                        <Controls:GridViewDataColumn.CellTemplate> 
                            <DataTemplate> 
                                <CheckBox IsChecked="{Binding Used, Mode=TwoWay}" 
                                          HorizontalAlignment="Center" 
                                          Checked="DataInfo_CheckedUnchecked" 
                                          Unchecked="DataInfo_CheckedUnchecked" /> 
                            </DataTemplate> 
                        </Controls:GridViewDataColumn.CellTemplate> 
                    </Controls:GridViewDataColumn> 
                </Controls:RadGridView.Columns> 
 
            </Controls:RadGridView> 


the "Metadata" from binding represents a List<Metadata> where Metadata object has this "Used" field represented by a checkbox.
In DataInfoHeaderMenu I can choose to select or deselect all rows in the radGridView 
I retrieve the metadata list from grid view 
(List<Metadata>)radGridView , I iterate over it and set for each object Used = true.

the problem is that this should have as a result all check-boxes checked but id doesn't!

Please help!
Roxana

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 10 May 2010, 01:25 PM
Hi RoxanaC,

RadGridView will sense and update UI on change  of the "Used" property but only if your Metadata class implements the INotifyPropertyChanged interface.
Otherwise , you will need to call the RadGridView.Rebind() method  after you update the underlying data.
Rebind will force the UI to update with the new state.

Best wishes,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
RoxanaC
Top achievements
Rank 1
answered on 10 May 2010, 01:46 PM
Thank you!
I already solved this with Rebind but I had some problems since I could not call Rebind from any place I wanted.

Best wishes!
Roxana
Tags
GridView
Asked by
RoxanaC
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
RoxanaC
Top achievements
Rank 1
Share this question
or