RadDock theming

10 posts, 0 answers
  1. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Jul 2009 Link to this post

    Hello,

    Our MDI Application has a RadDock in the main workspace.
    The theme has been reset.
    I allow the users to choose a theme for the application, and on choosing the theme, all of the controls have the theme applied correctly.

    If the user choosers Office2007Silver, then the background colour of the RadDock changes correctly to a silver/grey colour.
    On all other themes, the background colour stays the default blue.

    I'd like it to change together with the theme choice correctly. My available themes to choose are:
    Office2007Silver
    Default
    Breeze
    Desert
    Vista

    If this is not possible, I'd like to just set the background colour to a default of my choice, but choosing a new background colour for raddock (or the document container or dock panel) doesn't seem to make any difference.

    Thanks
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 09 Jul 2009 Link to this post

    Hello Richard,

    Currently we support Office2007Silver and ControlDefault themes from the list you provided.
    We will consider adding Breeze, Vista and Desert themes to Q2 2009 SP1 if we manage to implement the already promised functionality and fixes.

    Regards,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 10 Jul 2009 Link to this post

    Thanks for your reply Victor. However, this doesn't explain why I can't seem to set a default back colour on the control. If I could at least set the default back colour to grey, then it would fit in with all themes, rather than the blue that it is currently set to.

    Many thanks

    Richard
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 14 Jul 2009 Link to this post

    Hi Richard Slade,

    The back color you are seeing is the back color of the main document container. You can currently change the color through code like so:
     
    this.radDock1.MainDocumentContainer.BackColor = Color.Gray; 
     
    Note that the MainDocumentContainer property is set to Browsable.Never because the property has a setter, which is required by the serialization mechanism. It has been hidden to prevent users from changing the container dynamically and thus causing themselves trouble.

     
    Sincerely yours,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 14 Jul 2009 Link to this post

    Hello Victor,

    This still doesn't work for me.

    Example, I have
    RadForm BackColor set to AppWorkspace
    RadDock.BackColor set to Transparent
    DockPanel BackColor set to Transparent
    DocumentContainer BackColor set to Transparent

    I have tried setting colors for all of the RadDock items to no affect.

    I have also set the RadDock.MainDocumentContainer.BackColor (which I understand is the same as DocumentContainer) BackColor to Gray programmatically which still has no affect.

    Richard
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Jul 2009 Link to this post

    Hello Richard Slade,

    Please accept my apologies. When I used the latest version the suggested approach stopped working. In order to set the back color, you should do the following:
    this.radDock1.MainDocumentContainer.BackColor = Color.Pink;  
    RadElement el = this.radDock1.MainDocumentContainer.RootElement.Children[0].Children[0];  
    (el as FillPrimitive).BackColor = this.BackColor; 
    Let us know if we can help with anything else.

    Greetings,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 21 Jul 2009 Link to this post

    Thanks.
    For anyone else, this translates into VB as
    1             Dim element As Telerik.WinControls.RadElement = Me.DocumentContainer.RootElement.Children(0).Children(0)  
    2             DirectCast(element, Telerik.WinControls.Primitives.FillPrimitive).BackColor = Drawing.Color.Silver 


    Richard

     

  9. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Jul 2009 Link to this post

    Thought someone else might also be interested in this.
    The rad dock doesn't seem to accept all themes, and the background of a RadDock can sometimes look out of place with the current theme.

    For us, we have an MDI Application, with AutoDetect MDI Children set to true. When we change the theme to anything but Office2007Silver, or Default, then the background color can look a bit odd.(stays the default blue)

    to get around this, set your background color of your form, rad dock, maindocumentcontainer and dock panel to transparent. then pick up the backcolor changed event of one of the controls that will have it's color changed as you want it.

    Here, I am picking up the back color of my main menu

            Private Sub MainMenu_BackColorChanged(ByVal sender As System.Object, _  
                    ByVal e As System.EventArgs) Handles MainMenu.BackColorChanged  
     
                Dim element As Telerik.WinControls.RadElement = Me.DocumentContainer.RootElement.Children(0).Children(0)  
                DirectCast(element, Telerik.WinControls.Primitives.FillPrimitive).BackColor = Me.MainMenu.BackColor  
            End Sub 

    Hope that helps someone

    Richard
  10. Joris
    Joris avatar
    5 posts
    Member since:
    Dec 2009

    Posted 19 Jan 2010 Link to this post

    Hello,

    Thanks for this background tip.
    It works.

    But can I change the background where the tabs are also?
    Thanks in advance

    Joris
  11. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 22 Jan 2010 Link to this post

    Hi Joris,

    Currently, you can change the color of the TabStripElements by manually editing the RadDock xml theme files.

    A RadDock theme contains several xml theme files for the different RadDock parts. I am attaching a sample project to demonstrate this. Here are the changes which you need to make:
    1. Open TabStrip.xml and find the following code snippet:
    <XmlPropertySettingGroup>
      <PropertySettings>
        <XmlPropertySetting Property="Telerik.WinControls.VisualElement.BackColor" Value="191, 219, 254" />
        <XmlPropertySetting Property="Telerik.WinControls.UI.RadTabStripElement.ItemsOffset" Value="1" />
      </PropertySettings>
      <Selectors>
        <XmlTypeSelector ElementType="Telerik.WinControls.UI.RadTabStripElement" />
      </Selectors>
    </XmlPropertySettingGroup>

    2. Change the BackColor according to your preferences and Insert the following line in the PropertySettings block:
    <XmlPropertySetting Property="Telerik.WinControls.RadElement.ShouldPaint" Value="True" />

    The result code block is:
    <XmlPropertySettingGroup>
      <PropertySettings>
        <XmlPropertySetting Property="Telerik.WinControls.VisualElement.BackColor" Value="Red" />
        <XmlPropertySetting Property="Telerik.WinControls.UI.RadTabStripElement.ItemsOffset" Value="1" />
        <XmlPropertySetting Property="Telerik.WinControls.RadElement.ShouldPaint" Value="True" />
      </PropertySettings>
      <Selectors>
        <XmlTypeSelector ElementType="Telerik.WinControls.UI.RadTabStripElement" />
      </Selectors>
    </XmlPropertySettingGroup>

    The same operations should be performed in this code block:
    <XmlPropertySettingGroup>
      <PropertySettings>
        <XmlPropertySetting Property="Telerik.WinControls.VisualElement.BackColor" Value="191, 219, 254" />
        <XmlPropertySetting Property="Telerik.WinControls.UI.RadTabStripElement.ItemsOffset" Value="13" />
      </PropertySettings>
      <Selectors>
        <XmlTypeSelector ElementType="Telerik.WinControls.UI.RadTabStripElement" />
      </Selectors>
    </XmlPropertySettingGroup>

    For your convenience, I made the necessary changes in the TabStrip.xml. You can just replace the Red color with your own color.

    I hope this helps. If you have additional questions, feel free to contact me.

    Kind regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WinForms is Visual Studio 2017 Ready