Force trigger Refresh / update style UI

Hi, 

is there a way to force the datagrid UI to update/Refresh and run it's style converters again? 

using the multibinding converter in my app, the style Update/styke converters are not triggered upon change of cell value. 

The value itself is updated but the underlying style converter not triggered. 

As a workaround i reassign the Itemsource to the datagrid, but was wondering if there's another more elegant way. 


Best regards, 

Toby


3 Replies

NY Nirmalkumar Yuvaraj Syncfusion Team February 23, 2024 02:43 PM UTC

Hi Tobias,

 

Based on the information provided, we are uncertain about your requirements. To better assist you with your query, could you kindly provide us with more details regarding your requirements? Specifically, please provide details on where you used multibinding converter and how you modify the cell value. Are they from the same column or different columns in the Datagrid? Any additional information you can provide would be greatly appreciated, as it will allow us to offer you a more accurate and helpful solution. Additionally, if possible, please provide a code snippet or any other relevant details that may help us better understand your request. 

 

Regards,

Nirmalkumar



TH Tobias Horn February 23, 2024 03:00 PM UTC

Hi Nirmalkumar, 


not searching for fixing my code. Just if there's a way to force update the datagrid UI (including style converters). 

something like datagrid.Refresh()


Best regards, 

Toby



NY Nirmalkumar Yuvaraj Syncfusion Team February 26, 2024 12:48 PM UTC

Hi Tobias,


The only way to update both the datagrid UI and its converters is by modifying the binding context of the datagrid. You can preserve the datagrid's binding context in a separate variable and then reassign it to the datagrid after modifying the cell's value. This action triggers the datagrid converter at runtime. We have provided a code snippet for your reference.


Code snippet:

private void Button_Clicked(object sender, EventArgs e)

{

    var oldBindingContext = dataGrid.BindingContext;

    viewModel.Employees[0].EmployeeID = 100;

    dataGrid.BindingContext = null;

    dataGrid.BindingContext = oldBindingContext;

}



Regards,

Nirmalkumar


Loader.
Up arrow icon