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
35
Reset bold on all cells of an UltraWinGrid
posted

On an updateable  UltraWinGrid, I'm changing the bold setting on certain individual cells as the user updates values.

I have provided a cancel button and if the user clicks this, I want to reset all of the bold values for every cell.

I can't find any way to do this other than looping through every cell on the grid.

I've tried using the resetbold method at various levels, but I think because I've set the value at the lowest level, then none of the overrides have an effect.

Is there any easier way to reset all cell bold values?

  • 469350
    Offline posted

    This seems a little odd to me. The user is choosing which rows/cells are bold? Why is the purpose of that? If they are just changing the appearance of a cell for their own edification, I guess that makes sense. But it seems more likely to me that you will want to keep a list of the cells they bolded and do something with those cells later. If that's the case, then you are probably better off just keeping a List<UltraGridCell> in your code. Then you can loop through them and reset the bold on only the cells that have been bolded. And you could also perform an operation on those "selected" cells. 

    If you really just want the user to bold cells without any other practical application or any way to get the list of bold cells, then you could take the approach of using a single "bold" Appearance object and applying it to each cell, instead of setting the Font.Bold on the cell's appearance. This is more efficient, anyway. 

    Here's a sample app that demonstrates this approach. 

    7558.MemDataTable CS.zip

  • 12480
    Offline posted

    Hi James,

    My recommendation is to have two Appearance objects, one for normal text and one for bold text. When you want to make a cell bold, apply the bold appearance to that cell and add it to a List to keep track of which cells have been changed.

    When the user cancels and you want to reset all the bold values, loop through all the cells in the list and switch to using the normal appearance object for each cell.

    Please let me know if you have any questions.