I have a situation where the value of the cell will be updated. When the data is updated the styles of the cell will change. How can I trigger the redisplay of values on style change?
Hello Howard,
I have created a sample project for you, where I update the CellValuePresenter Styles in the XamDataGrid’s DataValueChanged event.
Hope this helps you.
I need to do this with custom Styles depening on the value of the cell. I used grdDataGrid_DataValueChanged and set the new style like
e.Field.Settings.CellValuePresenterStyleSelector = CellStyleSelector_Routine;
The problem that until the cell is redrawn the old style is displayed. It seems that CellValuePresenterStyleSelector
is only called once when the cell is just about to be displayed for the first time.
even when the value is changed the SelectgStyle is not called
How can I trigger the CellValuePresenterStyleSelector.SelectStyle to called when I the data is updated
In grdDataGrid_DataValueChanged
I tried
to reset the
e.Field.Settings.CellValuePresenterStyleSelector = CellStyleSelector.SelectStyle ;
e.Field.Visibility =Visibility.Visible;
and this did not work , ie did not trigger the re-evalution on the style.
I am pulling my hair out. ,,, How can trigger the SelectStyle?
Thank you for your post. I have been looking into it and I can suggest you see this blog:
http://mytorrey.com/2011/05/08/conditionally-formatting-cells-in-xamdatagrid-2/
which explains how to achieve conditional formatting in the XamDataGrid. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.