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
395
Appearance on CellClick event
posted

Hi,

If I setting an appearance on the current clicked cell (CellClick event) and than click on another cell, my appearance on the last cell getting lost.

What do i wrong?

            Appearance appearancePlus = new Appearance("minus");
            appearancePlus.Image = Resource1.add;

            Appearance appearanceMinus = new Appearance("plus");
            appearanceMinus.Image = Resource1.delete;

private void gridData_InitializeRow(object sender, InitializeRowEventArgs e){

          e.Row.Cells[0].Appearance = appearancePlus; //default

}

private void gridData_ClickCell(object sender, ClickCellEventArgs e){

          e.Cell.Appearance = appearanceMinus; //the picture should change and never getting lost

//thats work only so long as the current cell is selected

}

 

THX

  • 37774
    Verified Answer
    posted

    My only guess here is that something that you are doing is causing the InitializeRow event to fire (such as changing the value of another cell in that row).  You could get around this by only setting the Appearance in the InitializeRow event when the e.ReInitialize property is false.

    -Matt

  • 27093
    posted

    Hi,

    I have tried to reproduce this but my application works fine. From looking at your code snippet I'm guessing you are creating the Appearnace instances in the InitializeRow event and I can't figure out how you managed to get this running at all. I suggest creating appearanceMinus in either the ClickCell event or making it a global variable. If this doesn't work you are probably doing something elsewhere in your code that overrides it.

    Hope this helps.

    Sincerely,

    Petar Monov

    Developer Support Engineer,

    Infragistics, Inc