Hi,@don bradman .
- The PendingBills and AllBills of the ICollectionView bound to the DataGrid in your two TabItems are
m.PBills
andm.SBills
respectively. The data sources are different, so the views will not change synchronously.
When the data source of PendingBills and AllBills are the same, the view will change synchronously.
_penBills = m.PBills;
PendingBills = new ListCollectionView(_penBills)
{
Filter = o => ((Bills)o).PaidOn==""
};
_allBills = m.SBills;
AllBills = new ListCollectionView(_allBills)
{
Filter = o => ((Bills)o).Party == SelectedCBItem
};
2.Data CRUD works normally, and reloading program data updates normally. The current problem is that the view is not updated after modification.
There are three code blocks in the project that load data from the database, all of which are modified as follows. Even if the PaidOn of the newly added Item is empty, no error will be reported.
public void LoadAllBillsFroBillsbase()
{
...
foreach (DataRow row in dt.Rows)
{
**var p = (row["PaidOn"] == DBNull.Value) ? String.Empty : (string)(row["PaidOn"]);**
_sBills.Add(new Bills()
{
Id = Convert.ToInt32(row["Id"]),
Party = (string)row["Party"],
BillNo = (string)row["BillNo"],
BillDt = (string)(row["BillDt"]),
Amt = (string)row["Amt"],
DueDt = (string)(row["DueDt"]),
//PaidOn = (string)(row["PaidOn"])
**PaidOn = p**
});
}
m_dbConnection.Close();
}
I'm trying to find a solution to update the view in time and will come back if there are any updates.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.