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
560
Can grid columns have separate fonts
posted

Hello all,

Can the individual WinGrid columns have separate fonts assigned to them in code? As an example, if I wanted to make the selected coumn header text Bold or a different color, can I do that? If so, how do I get to the column Font? Thanks in advance for any ideas and/or suggestions!

Parents
No Data
Reply
  • 69832
    Offline posted

    One possible solution:

    this.ultraGrid.BeforeSelectChange += new BeforeSelectChangeEventHandler(ultraGrid_BeforeSelectChange);

    void ultraGrid_BeforeSelectChange(object sender, BeforeSelectChangeEventArgs e)
    {
        UltraGrid grid = sender as UltraGrid;

        if ( e.Type == typeof(Infragistics.Win.UltraWinGrid.ColumnHeader) )
        {
            if ( grid.Selected.Columns.Count == 1 )
                grid.Selected.Columns[0].Appearance.Reset();

            if ( e.NewSelections.Columns.Count == 1 )
            {
                e.NewSelections.Columns[0].Column.Header.Appearance.FontData.Bold = DefaultableBoolean.True;
                e.NewSelections.Columns[0].Column.Header.Appearance.ForeColor = Color.Red;
            }
        }
    }

Children