Hi,
i am trying to change the font style of the selected cells of a grid:
private bool M_MakeCellsBold(bool value)
{
foreach (Cell c in XamMainGrid.SelectionSettings.SelectedCells)
if (c.Control != null)
c.Control.FontWeight = value ? FontWeights.Bold : FontWeights.Normal;
return value;
}
the problem is the selected cells that are not visible are returning the control as null so if i have a selected cell that is hidden (scroll) it wont be affected.
is there any other way to achieve this?
another question can i make the cell text underlined?
thanks
Hi Georgi,
I want to wish you a happy new year :)
thanks for the reply
actually i am not changing the style of the selected cells once they are selected. i have a Bold Button that, when pressed should make the selected cells Bold.
can i make the cell text underlined??
One way to achieve this is to use a Style set on the Cell instead of setting the property directly on the CellControl. I attached a small sample that demonstrates that.
Propably a better approach would be to edit the control template of the cell and modify the "Selected" visual state to fit your needs. You can find the default template in the "Default Styles" folder under the installation path of the product (there should be a start menu link pointing to this location).
Hope this helps,