Formatting Scheduler Resource Header Cell Element

4 posts, 0 answers
  1. Allen
    Allen avatar
    2 posts
    Member since:
    Oct 2011

    Posted 22 Aug Link to this post

    Using the Visual Style Builder to set theme colors I can see how to modify the Scheduler Header Cell Element, but where is the Resource Header Cell Element modified?  I would to set this in the theme because my application allows loading of predefined themes; therefore I prefer not to use the SchedulerCell_Format event.  Thank you for any guidance you can provide.
  2. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 23 Aug Link to this post

    Hello Allen,

    Thank you for writing. 

    SchedulerResourceHeaderCellElement's color depends on the resource's color that is applied. It is not possible to customize the SchedulerResourceHeaderCellElement in Visual Style Builder. Feel free to use the CellFormatting event and apply the desired style to the header cells. Here is a sample code snippet:
    Font f = new Font("Arial", 14f, FontStyle.Italic);
     
    private void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
    {
        SchedulerResourceHeaderCellElement headerCell = e.CellElement as SchedulerResourceHeaderCellElement;
        if (headerCell != null)
        {
            headerCell.Font = f;
        }
        else
        {
            e.CellElement.ResetValue(VisualElement.FontProperty, ValueResetFlags.Local);
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Allen
    Allen avatar
    2 posts
    Member since:
    Oct 2011

    Posted 23 Aug Link to this post

    Thanks.  That helped get me going down the right road.  Is there a way to turn off the resource color from being applied to the Scheduler Cell elements?  I understand how to change the header cell format, but by default it looks like a percentage of the resource color is being "overlayed" on the scheduler cell colors.
  5. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 24 Aug Link to this post

    Hello Allen, 

    Thank you for writing back. 

    In order to customize the cell's back color, you can set the CellElement.BackColor property. In addition, it is necessary to set the Opacity property to to obtain the desired color.
    private void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
    {
        e.CellElement.Opacity = 1;
        SchedulerResourceHeaderCellElement headerCell = e.CellElement as SchedulerResourceHeaderCellElement;
        if (headerCell != null)
        {
            headerCell.BackColor = Color.Pink;
            headerCell.GradientStyle = GradientStyles.Solid;
        }
        else if (e.CellElement is SchedulerCellElement && e.CellElement.Date.Year > 1999 && e.CellElement.Text == string.Empty)
        {
            e.CellElement.BackColor = Color.Yellow;
            e.CellElement.GradientStyle = GradientStyles.Solid;
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.OpacityProperty, ValueResetFlags.Local);
        }
    }

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top