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

problem with GridViewCheckBoxColumn in WPF

6 Answers 720 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gudla
Top achievements
Rank 1
Gudla asked on 10 Mar 2011, 01:29 PM
Hi,

I have problem with telerik GridViewCheckBoxColumn.

The code is

 <telerik:GridViewCheckBoxColumn   SourceUpdated="IsAchievedColumn_SourceUpdated" Header="{x:Static resources:MultilingualTranslations.Rebates_Admin_RebateDetailsJbp_DataGrid_IsAchievedColumn_HeaderCaption}" 
                                            IsReadOnly="False"  x:Name="IsAchievedColumn"  DataMemberBinding="{Binding IsAchieved,Mode=TwoWay,UpdateSourceTrigger= PropertyChanged}" >

When I edit checkbox with unchecked then it is not immediatly setting IsAchieved property to false ,it is doing when I remove the focus from the cell.I hope you understand the problem.



Can you please suggest what needs to be done ASAP please.


6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 11 Mar 2011, 03:00 PM
Hello Gudla,

Generally, this would be the expected behavior since the changes are committed after the CellEditEnded even has been executed. What you may try to do for updating the property without the need of losing the focus is to define you column as follows:

<telerik:GridViewDataColumn DataMemberBinding="{Binding IsPlaying}" IsReadOnly="True">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding IsPlaying, Mode=TwoWay}"
                                  telerik:StyleManager.Theme="Office_Black"/>
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>

Furthermore, you might take a look at this article for a further reference.


Best wishes,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Vikash
Top achievements
Rank 1
answered on 25 Apr 2012, 11:14 AM
Hello Team,

If we scroll down in RadgridView,then selected checkbox got unselected.
Please provide solution to this problem ASAP.

Here is code :

 
<telerik:RadGridView Name="grdForms" Margin="367,134,0,0" SelectionUnit="Cell" ShowGroupPanel="False" Width="320" Height="500" HorizontalAlignment="Left" VerticalAlignment="Top" AutoGenerateColumns="False" PreviewMouseLeftButtonUp="grdForms_PreviewMouseLeftButtonUp">
           <telerik:RadGridView.Columns>
               <telerik:GridViewDataColumn>
                   <telerik:GridViewDataColumn.CellTemplate>
                       <DataTemplate>
                           <CheckBox IsChecked="{Binding IsPlaying, Mode=TwoWay}"
                                 telerik:StyleManager.Theme="Office_Black"/>
                       </DataTemplate>
                   </telerik:GridViewDataColumn.CellTemplate>
               </telerik:GridViewDataColumn>
               
               <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID" IsVisible="False" TextAlignment="Left" Width="*" />
               <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Form Name" TextAlignment="Left" Width="*" />
           </telerik:RadGridView.Columns>
       </telerik:RadGridView>
0
Maya
Telerik team
answered on 25 Apr 2012, 11:17 AM
Hi Vikash, 

Generally, such behavior can be reproduced if the binding is not correct. Could you provide a bit more information about the way you define your column ?  


Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Vikash
Top achievements
Rank 1
answered on 25 Apr 2012, 11:26 AM
 Hello team,
 Please check the code.If there are too many records in radgridview if we checked first record then scroll to last one then the first one i.e selected becomes unselected.

<
telerik:RadGridView Name="grdForms" Margin="367,134,0,0" SelectionUnit="Cell" ShowGroupPanel="False" Width="320" Height="500" HorizontalAlignment="Left" VerticalAlignment="Top" AutoGenerateColumns="False" PreviewMouseLeftButtonUp="grdForms_PreviewMouseLeftButtonUp">
           <telerik:RadGridView.Columns>
               <telerik:GridViewDataColumn>
                   <telerik:GridViewDataColumn.CellTemplate>
                       <DataTemplate>
                           <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}"
                                 telerik:StyleManager.Theme="Office_Black"/>
                       </DataTemplate>
                   </telerik:GridViewDataColumn.CellTemplate>
               </telerik:GridViewDataColumn>
                
               <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID" IsVisible="False" TextAlignment="Left" Width="*" />
               <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Form Name" TextAlignment="Left" Width="*" />
           </telerik:RadGridView.Columns>
       </telerik:RadGridView>
0
Maya
Telerik team
answered on 25 Apr 2012, 11:28 AM
Hi again,

Could you try setting DataMemberBinding property of the column ? Do you get the same behavior ? 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Vikash
Top achievements
Rank 1
answered on 25 Apr 2012, 12:16 PM
Hi Maya,

Thanks for your help.
  
One more issues in radgridview.

how to get row in radgridview.I am using this code but its return null for those rows which are hidden by radgridview.
  for (int rowCounter = 0; rowCounter < grdForms.Items.Count; rowCounter++)
                {
                    object o = grdForms.Items[rowCounter];
                    GridViewRow grdFormRow = (GridViewRow)grdForms.ItemContainerGenerator.ContainerFromItem(o);
                    if (grdFormRow != null)
                    {
 
 
}
}

Tags
GridView
Asked by
Gudla
Top achievements
Rank 1
Answers by
Maya
Telerik team
Vikash
Top achievements
Rank 1
Share this question
or