I have List<object> and DataGrid bound to it with IPropertyChanged interface. I would like that changes in DataRowCells are reflected in object properties. I have also implemented CheckBox in DataGrid and Textbox and i would like that text from TextBox update specific column cells of all selected (checked) rows. So I must change one cell of each selected row based on one TextBox, and that change should be saved in bound object. For example I want that for all selected rows cell SUPPLIER_ID take value of TextBox text, and that value should be reflected in bound objects prop SUPPLIER_ID
My Collection in ViewModel:
private List<Article> articlesFalseCatalogGroup;
public List<Article> ArticlesFalseCatalogGroup
{
get { return articlesFalseCatalogGroup; }
set
{
articlesFalseCatalogGroup = value;
OnPropertyChanged("ArticlesFalseCatalogGroup");
}
}
This is one prop from object:
public class Article: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propname)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propname));
}
#region Standard fields
private string _SUPPLIER_AID;
public string SUPPLIER_AID
{
get { return _SUPPLIER_AID; }
set
{
_SUPPLIER_AID = value;
OnPropertyChanged("SUPPLIER_AID");
}
}
XAML DataGrid:
<DataGrid Grid.Column="1"
AutoGenerateColumns="True"
ItemsSource="{Binding ArticlesFalseCatalogGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Select" IsThreeState="True" />
</DataGrid.Columns>
</DataGrid>