Ticket T586747
Visible to All Users

How to apply a skin to a NavBar at runtime

created 7 years ago

Hello,

I need to change the skin of the navbar for code. I'm trying this

TdxNavBarSkinExplorerBarPainter(dxNavBar1.ViewStyle).SkinName := 'DevExpressDarkStyle';
TdxNavBarSkinExplorerBarPainter(dxNavBar1.ViewStyle).SkinNameAssigned := True;

but it doesn't work.

Best regards.

Answers approved by DevExpress Support

created 7 years ago

Hello,

The following code should apply the DevExpressDarkStyle skin to a NavBar with the SkinExplorerBarView view style:

Delphi
uses dxSkinsdxNavBarPainter; TdxNavBarSkinExplorerBarPainter(dxNavBar1.ViewStyle).SkinName := 'DevExpressDarkStyle';

If it does not work, I recommend you check whether the NavBar.ViewStyle property has the "SkinExplorerBarView" value. In case this does not help, please provide us with a small test project with an executable file (EXE) that demonstrates your situation.

    Comments (2)
    R R
    ROBERTO MOUCO RODRIGUEZ 7 years ago

      Hello,

      I need to use NavBar.ViewStyl:=SkinNavigationPaneView . In design mode it works but not in runtime mode.

      DevExpress Support Team 7 years ago

        Hello,

        Thank you for the sample. I've examined it and see that your code is incorrect. You are using the SkinNavigationPaneView view style. However, in the project you cast the dxNavBar.ViewStyle property to the Painter's class of the SkinExplorerBarView style. It is incorrect.
        I recommend you set a breakpoint in your code and check the class name of the dxNavBar.ViewStyle property at that moment:

        Delphi
        dxNavBar.ViewStyle.ClassName

        As a result you will get the correct class name that should be used for casting:

        Delphi
        TdxNavBarSkinNavPanePainter(dxNavBar1.ViewStyle).SkinName := ...;

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.