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
5520
Selected Cells problem
posted

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

Parents
  • 6475
    posted

    Hi,

    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,

    SilverlightApplication1.zip
Reply Children
No Data