RadPageViewItem color

2 posts, 0 answers
  1. Eric
    Eric avatar
    9 posts
    Member since:
    Sep 2011

    Posted 22 Dec 2011 Link to this post

    I have a RadPageView (DetailTabControl).  I want to change the strip item's back color to red under some condition.  Then I might need to change it back.  I figured out how to change it to red.  Restoring the prior values does not restore the tab as I expected.  The back color (which I caught before setting to Red, ARGB(255, 191, 219, 255)) is for that of the PageView, not the PageViewPage.  Please see attached images.

    public class Globals
    {
    public static Color DefaultTabColor = Color.FromArgb(255, 191, 219, 255);
    }
    ...
    private void CancelTab(int offset)
    {
         DetailTabControl.Pages[offset].Item.DrawFill = true;
         DetailTabControl.Pages[offset].Item.NumberOfColors = 1;
         DetailTabControl.Pages[offset].Item.BackColor = Color.Red;   
    }
    private void UncancelTab(int offset)
    {
         DetailTabControl.Pages[offset].Item.BackColor = Globals.DefaultTabColor;
         DetailTabControl.Pages[offset].Item.NumberOfColors = 2;
         DetailTabControl.Pages[offset].Item.DrawFill = false;
    }

  2. Stefan
    Admin
    Stefan avatar
    2455 posts
    Member since:
    Sep 2012

    Posted 27 Dec 2011 Link to this post

    Hello Eric,

    Thank you for writing.

    You can reset the values of every RadObject to different states of their values by using the Reset method. In your case you need to reset them to Local settings. Here is how your UncancelTab method should look like:

    private void UncancelTab(int offset)
    {
        DetailTabControl.Pages[offset].Item.ResetValue(RadPageViewItem.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        DetailTabControl.Pages[offset].Item.ResetValue(RadPageViewItem.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local);
        DetailTabControl.Pages[offset].Item.ResetValue(RadPageViewItem.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
    }

    I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us. 

    Greetings,
    Stefan
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

  3. DevCraft Release
Back to Top