How to disable the color change of the form when focus is changed to another form

2 posts, 0 answers
  1. Erwin
    Erwin avatar
    10 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    Hello,

    I cannot find where I have to modify the style of the RadForm to disable the fact that the color (of the title bar especially) changes (it becomes lighter, with Office2007Black theme) when the form loses focus (if we switch from one form to another).

    Any direction would be more than welcome!

    Thanks,

    Erwin
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 21 Oct 2009 Link to this post

    Hello Erwin,

    Thanks for writing and for your question.

    Basically, you can edit Office2007Black theme of RadForm and RadTitleBar in Visual Style Builder and remove the conditions which define the styles of the Form when it is activated/deactivated.

    However, since we discovered a small issue which can prevent you from normally editing the theme of RadForm, there are a few steps which you should follow in order to be able to successfully customize the theme. We have already addressed this issue, and the fix will be available in Q3 2009 which is due for the beginning of November.

    Please take a look at these steps which should guide you through:

    1. Open the XML file that I am attaching in a text editor (like Notepad) and find the following XML construct:

    <StylesheetRelations>

            <RadStylesheetRelation ControlType="Telerik.WinControls.UI.RadForm" ElementType="Telerik.WinControls.RootRadElement" />

    </StylesheetRelations>


    Basically, this snippet instructs our theming mechanism that the stylesheets defined between the two XmlStyleBuilderRegistration tags are only relevant when the control is of type Telerik.WinControls.UI.RadForm. The ElementType attribute determines that the stylesheets will be applied to all elements down the element tree, starting from an element of type RootRadElement, i.e. the root of the element hierarchy (the hierarchy of visual elements which sum up to the appearance of the control) of RadForm.

    2. Change the XML construct in the following way:

    <StylesheetRelations>

            <RadStylesheetRelation ControlType="Telerik.WinControls.UI.RadForm" ElementType="Telerik.WinControls.UI.FormRootElement" />

    </StylesheetRelations>


    3. Open the theme in Visual Style Builder: you will see the default Office2007Black theme settings for RadForm. Now, take a look at the tree view on the left and select the FormBorderPrimitive node. You will see the IsFormActive conditions in the tab strip next to the tree view and below the design view in Visual Style Builder. You can remove the !IsFormActive condition which defines the settings for the appearance of the border of the form when in inactive state.
     
    After finishing your modifications, you should save the theme to a separate file and revert the Telerik.WinControls.UI.FormRootElement line (from the StyleSheetRelations construct shown above) back to Telerik.WinControls.RootRadElement and save the changes again. Then you can load the theme using the RadThemeManager and use it in your project.


    For the following procedure you do not need to modify the XML of the theme as you did above for RadForm:

    The second thing to do here is to modify the RadTitleBar Office2007Black theme so that it does not change its background when the form changes its state.

    To do this, load RadTitleBar control in Visual Style Builder and load its Office2007Black theme (also attached to this post). Take a look at the tree view on the left and find the FillPrimitive direct under the RadTitleBarElement node. Select it and delete its !IsFormActive condition. Save the theme and use it in you project by loading it from RadThemeManager.

    I am attaching the Office2007Black theme for your convenience.

    I would also like to inform you that for Q3 2009 we will introduce a property in RadForm which you will be able to use in order to control the behavior of the Form when in active/inactive state. In this way you do not need to edit themes in Visual Style Builder as described above.

    I hope this is helpful. Do not hesitate to write back if you have further questions.

    Best wishes,
    Deyan
    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top