I am using DataGrid (bind to the obeservable collection), one of the column in the datagrid is checkbox, User Requirement is, when user checks checkbox in any row, other row's checkbox should reset to unchecked. means only one checkbox checked at a time.
I tried using INotifyPropertyChanged but no luck, please suggest. Thanks
<igGrid:XamWebGrid x:Name="_dgAppInfo" AutoGenerateColumns="False" ColumnWidth="*" ItemsSource="{Binding AppList}"> <igGrid:XamWebGrid.EditingSettings> <igGrid:EditingSettings AllowEditing="Row" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True" /> </igGrid:XamWebGrid.EditingSettings> <igGrid:XamWebGrid.SelectionSettings> <igGrid:SelectionSettings CellClickAction="SelectRow" RowSelection="Single"></igGrid:SelectionSettings> </igGrid:XamWebGrid.SelectionSettings> <igGrid:XamWebGrid.Columns> <igGrid:TextColumn Key="AppID" HeaderText="ID"/> <igGrid:TextColumn Key="AppName" Width="*" HeaderText="Name"/> <igGrid:CheckBoxColumn Key="AppActive" Width="*" HeaderText="Active"/> </igGrid:XamWebGrid.Columns> </igGrid:XamWebGrid>
It should work with List<T>, but like I said, you need to make sure the objects in your List<T> implement the INotifyPropertyChanged interface.
Devin
Hi,
Thanks for reply. So, I've to take the ObservableCollection or it can be worked with System.Collection.Generic.List<>, if yes then please reply with example. You can send me code on pragati.dukale@revalanalytics.com
Please, help.
Thanks,
Pragati
If possible, the best way to do this is to ensure that the objects in your List implement INotifyPropertyChanged. The grid will atomatically listen for the property change notifications and updated itself immediately when the object properties are updated.
Sorry, one correction -
igAddresses.UpdateLayout();
should be before the
break;
Still no change in output.
Pragati.
I get another solution, its getting saved to grid, but not refreshing the grid immediately. The changes are getting reflected on next visit to page. The code is like -
void btnEditUpdate_Click(object sender, RoutedEventArgs e) { int iAddTypeID = 0; iAddTypeID = SelectedRow.AddTypeID; for (int iRowCnt = 0; iRowCnt < igAddresses.Rows.Count; iRowCnt++) { if (iAddTypeID == ((Address)igAddresses.Rows[iRowCnt].Data).AddTypeID) { ((Address)igAddresses.Rows[iRowCnt].Data).AddLine1 = txtEditCompanyAddLine1.Text;
--------
((Address)igAddresses.Rows[iRowCnt].Data).CountryCode = Convert.ToInt32(((ComboBoxItem)cmbEditCountry.SelectedItem).Tag); break; } igAddresses.UpdateLayout(); } }
How the changes will reflect immediately on this click?