RadPageViewItem color

14 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
    2910 posts

    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. Shakti SIngh Dulawat
    Shakti SIngh Dulawat avatar
    89 posts
    Member since:
    Oct 2009

    Posted 29 Jul 2016 Link to this post

    Thanks a lot Eric that was wonderful example 
  4. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 26 Aug 2019 Link to this post

    i want to change style and color of RadPageView Tabs like this(Please see the attached image)

    can you please give me a solution ?

     

  5. Nadya
    Admin
    Nadya avatar
    243 posts

    Posted 27 Aug 2019 Link to this post

    Hello, Raneesras,

    According to the provided screenshot, it seems that you use RadPageView in StripView mode. In order to style the page view considering the design from the picture, I can suggest you to access the RadPageViewStripElement and set a shape to its items at the top right corners. You can set appropriate backcolor as well. Please refer to the following code snippet:



    public Form1()
    {
        InitializeComponent();
     
        RadPageViewStripElement stripElement = (RadPageViewStripElement)this.radPageView1.ViewElement;
        stripElement.Items[0].DrawFill = true;
        stripElement.Items[0].GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        stripElement.Items[0].Shape = new RoundRectShape(70, false, false, true, false);
        stripElement.Items[0].Text = "Purchase";
        stripElement.Items[0].BorderColor = Color.FromArgb(255, 126, 188, 242);
        stripElement.Items[0].BackColor = Color.FromArgb(255, 126, 188, 242);
     
        stripElement.Items[1].DrawFill = true;
        stripElement.Items[1].GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        stripElement.Items[1].Shape = new RoundRectShape(70, false, false, true, false);
        stripElement.Items[1].Text = "Purchase Book";
        stripElement.Items[1].BorderColor = Color.FromArgb(255, 126, 188, 242);
        stripElement.Items[1].BackColor = Color.FromArgb(255, 126, 188, 242);
     
        stripElement.Items[2].DrawFill = true;
        stripElement.Items[2].GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        stripElement.Items[2].Shape = new RoundRectShape(70, false, false, true, false);
        stripElement.Items[2].Text = "Purchase Order";
        stripElement.Items[2].BorderColor = Color.FromArgb(255, 126, 188, 242);
        stripElement.Items[2].BackColor = Color.FromArgb(255, 126, 188, 242);
     
    }

    Note that you can customize the theme you use in your application in a way which is closest to your expected design by using Visual Style Builder. You can read more details about using the Visual Style Builder here:

    1.     Loading predefined themes
    2.     Working with Repository Items
    3.     Saving and Loading Theme Files
    4.     Loading Themes from an External File
    5.     Loading Themes from a Resource
    6.     Applying Theme to a Control
    7. https://www.telerik.com/videos/winforms/what-is-new-in-visual-style-builder-for-q1-2010

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Nadya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  6. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 27 Aug 2019 in reply to Nadya Link to this post

    hii Nadya...that RoundRectShape not working properly....
  7. Nadya
    Admin
    Nadya avatar
    243 posts

    Posted 28 Aug 2019 Link to this post

    Hello, Raneesras,

    I have attached my sample project for your reference. Could you please give it a try and see how it works on your end? Am I missing something?

    However, if this doesn't solve the problem you are facing, feel free to modify the project in a way to reproduce the undesired behavior and get back to me with it so I can investigate it further. Thank you in advance. 

    I am looking forward to your reply.

    Regards,
    Nadya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  8. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 28 Aug 2019 in reply to Nadya Link to this post

    thank you Nadya....its worked.....one more thing..is it possible to change tab close button color and size ?
  9. Nadya
    Admin
    Nadya avatar
    243 posts

    Posted 29 Aug 2019 Link to this post

    Hello, Raneesras,

    Yes, it is possible to achieve this. By default, the close button icon in RadPageView is represented as an image. You can change it and apply an appropriate image according to your requirements by using the following code snippet:

    stripElement.Items[0].ButtonsPanel.CloseButton.Image = //your image here;

    Another approach I can suggest is to use the glyphs mechanism instead of images via the TelerikWebUI font. Thus, you will benefit the quality stability of the icons when using the glyphs approach when increasing the font size. It is necessary to set the appropriate glyph number to the Text property and use the specified font in order to draw the close icon in the tab. Thus, you will be able to set the desired color and size of the close icon. Please refer to the following code snippet which result is illustrated below:

    var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI");
    stripElement.Items[0].ButtonsPanel.CloseButton.CustomFont = font1.Name;
    stripElement.Items[0].ButtonsPanel.CloseButton.Text = "\ue11B";
    stripElement.Items[0].ButtonsPanel.CloseButton.CustomFontSize = 14;
    stripElement.Items[0].ButtonsPanel.CloseButton.ForeColor = Color.Red;
    stripElement.Items[0].ButtonsPanel.CloseButton.DrawImage = false;



    More information about glyphs and the TelerikWebUI font is available here: https://docs.telerik.com/devtools/wpf/styling-and-appearance/glyphs/common-styles-appearance-glyphs-overview

    I hope this helps. Should you have any other questions, I will be glad to help.

    Regards,
    Nadya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  10. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 30 Aug 2019 in reply to Nadya Link to this post

    hiii Nadya....i can't access these all.... i am using Telerik 2015 version

    please check the attached image

    regards,

    Ranees ras

  11. Nadya
    Admin
    Nadya avatar
    243 posts

    Posted 30 Aug 2019 Link to this post

    Hello, Raneesras,

    Telerik UI for WinForms supports custom fonts since R2 2017. If you are using an older version you shouldn't be able to have access to  the custom font. After changing to the latest version, everything will work as expected.

    Could you please upgrade to the latest version and see how it works? Thus, you can also benefit from all the introduced changes and improvements.

    I am looking forward to your reply.

    Regards,

    Nadya

    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  12. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 31 Aug 2019 in reply to Nadya Link to this post

    hiii Nadya....its worked perfectly...Thanks for your time 

    regards,

    Ranees Ras

  13. Ras Ran
    Ras Ran avatar
    134 posts
    Member since:
    Nov 2018

    Posted 03 Sep 2019 Link to this post

    hii is there any option to get closing page details in page closing event whether its selected page or not ?? 
  14. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3713 posts

    Posted 06 Sep 2019 Link to this post

    Hello, Raneesras,    

    When you click the close button, the RadPageView.PageRemoving event is fired. In the RadPageViewCancelEventArgs you have access to the affected page. If you need to determine whether this page is selected and can simply compare it with the RadPageView.SelectedPage:

            public RadForm1()
            {
                InitializeComponent();
                
                this.radPageView1.ViewElement.ShowItemCloseButton = true; 
                this.radPageView1.PageRemoving += radPageView1_PageRemoving;
            }
            
            private void radPageView1_PageRemoving(object sender, RadPageViewCancelEventArgs e)
            {
                bool isSelected = e.Page == this.radPageView1.SelectedPage;
                Console.WriteLine(isSelected);
            }

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top