Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have C# WPF project that is save data from DataGrid into a Table in SQL Server Database

In Database I have two tables as Factor and Commodity that related to each other and

-The ItemsSource of the DatGrid is filled from the Factor table
-The ItemsSource of the DataGridComboBoxColumn is filled with Commoditiy (the Item source of DataGrid and comboBoxColumn are diffrent)

When I want to Realod DataGrid's Data by "select * from Factor" I Only Reloaded the DataGrid's ItemsSource not The ItemsSource of the DataGridComboBoxColumn
why DataGridComboBoxColumn's ItemsSource will refresh (as if moving on each item)


What I have tried:

https://stackoverflow.com/questions/73620756/how-can-i-prevent-the-observablecollection-from-being-refreshed-for-no-reason-in[^]
Posted
Comments
Member 15627495 6-Sep-22 10:37am    
It's a dependancy behavior,
the datagridcomboboxcolumn is part of the datagrid.

When you refresh the 'parent', the 'child' is redrawn.

try to bind better your datagridcomboboxcolumn to avoid this reedundant refresh on your datagridcomboboxcolumn.

by another event of the datagrid to reload datagridcomboboxcolumn,
or by 'stepping' with conditions : the datagridcomboboxcolumn will refresh just one time...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900