locked
How do I add an anchor to the navbar

    Question

  • I have a navbar with several commands.  By default, the commands are from left to right.  How do I add a command or other object to the navbar that is displayed on right side of navbar?  section: 'selection'  only seems to work with the appbar and appbar commands.

    Monday, August 25, 2014 2:10 PM

Answers

  • Hi hxnwx,

    There is no directly way to do this, all the navbar command are start from left to right.

    However we can do something like 'hack' the CSS, for instance I manually set a position for the navbar command (or maybe you have a better CSS way to do this):

            <div data-win-control="WinJS.UI.NavBarContainer">
                <div style="; right:10px;" data-win-control="WinJS.UI.NavBarCommand" data-win-options="{ label: 'Home', icon: 'url(../images/homeIcon.png)' }"></div>
                <div style="; right:210px;" data-win-control="WinJS.UI.NavBarCommand" data-win-options="{ label: 'Favorite', icon: 'favorite' }"></div>
            </div>
    Note: something wrong with the pasted code, position = absolute cannot be displayed here.

    The result looks fine:

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, August 26, 2014 2:18 AM
    Moderator