Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
920
Cell Style in condition to value of cell
posted

Hi,

 

I have a grid and a string column in it. If the value is not Empty I will set the Style to Button else to Default.

The reason is the string defines the text of the button an an empty string meants no button.

 

so long no real problem.

 

i use a BindingList<> as Datasource

if the value of the string changes (also some other things in the grid change) the new value is drawn in the grid.

That's fine.

But the

AfterCellUpdate, AfterRowUpdate and also the AfterRowInsert Event is not fiering.
but the Cell Value Change and a "child" row is added.

So I'm looking for a event that indicates the BindingList<> has changed and is new displayed. At the moment I use the Paint event ... it woks cause i have a very small grid but I think this is no good way.

 

Is there a event on the grid that I can use? In what cases does the value of a cell changed whitout firing a AfterCellUpdate event.

Or is there something else to change the style of a cell depending on the content of the cell?

 

Thanks

  Wolfgang

 

Parents Reply
  • 469350
    Verified Answer
    Offline posted in reply to Wolfgang Bolz

    Hi Wolfgang,

    Wolfgang77 said:

    It was not clear to me from your original post that you were changing the data on the data source and not through the grid. But you are correct - you have to implement INotofyPropertyChanged in order for the DotNet BindingManager to know that something changed and to send the proper ListChanged notifications to the grid.

    Wolfgang77 said:

    At the moment I get the ListChanged of my first Bindinglist (of type A) and do there my Code cause i dont know what Event is fired if I remove a Element of the BindingList in A of Type B.

    The row disapears as expected but what Event is Cause if a row is Deleted? Its not AfterRowsDeleted.

    Any Idea what Event is Fired in this case? My current way works as well, but i woud like to let the Format be done by the sourounding source and not by my logic class,

    No event of the grid is fired in this case. The grid is responding to an event notification from the BindingManager here. It's a listener to an event here, not the trigger.

    It sounds to me like you need to be responding to events of the BindingManager or BindingList and then refresh the grid using the grid.Rows.Refresh method. 

Children