Formatting background of individuel themedatagrd cell

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 12 years ago by Bret Naughton
Version: 11.1.0545
Avatar
Hi,

I am sourcing a data table to a themedatagrid (by required column).

What I want to do now is to set the background color of an individual themeddatagrid cell, based on traffic lightng values that I obtain by looping and analysing the row/columm cells in the datatable.

Is it possible to color code individual cells, as I am having trouble achieving this.

Barry

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

It looks like you should just able to set the DataGridCell.Background property appropriately. If put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 12 years ago by Bret Naughton
Avatar
Thanks for that, this command should do the trick. However, I have one more question. I am trying to loop through all the cells in the ThemedDataGrid column by row, to check the value of the cell, and therefore set the background cell color using the command you provided.

I am not having any luck in being able to programatically loop through the themeddatagrid cells and therefore set the DataGridCell.Background. Do you have an example of this code for doing this looping (There seems to be a property to be able to loop on columns, but not rows/cells.

Thanks,
Bret
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

Our ThemeDataGrid is an derivation of the Microsoft DataGrid, and we only support our extensions/themes. General DataGrid questions should be directed to Microsoft or a third-party Q&A site (such as StackOverflow).

But you may be able to use our VisualTreeHelperExtended.GetAllDescendents to find all the DataGridCells. But because of virtualization, you'd probably need to update that every time you scroll, which would get intensive.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.