Introduction
The Command Bar control in a UAP is a new control in Universal Windows programming. It is like a toolbar control or upgrades version for an App bar control in Windows 8.1, we can place a Command Bar anywhere in the UI, like top or bottom or anywhere.
A Command Bar is divided into the following two main areas or two property areas.
- Content
- Command Area
Display Mode
- Compact: Display Command Bar with icon mode, the text is hidden
- Minimal: Display Command Bar, icon and text are hidden
- Hidden: Complete Command Bar is hidden.
- FlowDirection: We can change the content area from the left to the right using the FlowDirection property.
Note
Content and Command areas are optional, either can be present or both.
The Content area is like a container, we can place any control inside the content area.
Example
Content
- <CommandBar.Content>
- <StackPanel Margin="10,2">
- <TextBlock Text="Update status Here !!!"/>
- <ProgressBar Maximum="100" Minimum="0" Height="15" Value="25"/>
- </StackPanel>
- </CommandBar.Content>
Command Area
Note
All three controls are not necessary to be present in the Command Bar.
- Primary commands
- Secondary commands
Commands
Primary Command Area
- <CommandBar.PrimaryCommands>
- <AppBarButton Label="Add Recored" Icon="Add" Click="AppBarButton_Click"/>
- <AppBarSeparator/>
- <AppBarToggleButton Label="Edit Recored" Icon="Delete" Click="AppBarToggleButton_Click"/>
- <AppBarButton>
- <ProgressBar Maximum="100" Minimum="0" Height="15" Value="25"/>
- </AppBarButton>
- </CommandBar.PrimaryCommands>
Note
It is a best practice to add the tag of the primary command always.
Secondary commands
- IsSticky: True, the menu will display until the click of any menu item in the Command Bar.
- IsSticky: False, the menu will disappear, click anywhere outside the menu item (the default mode).
Note
the IsSticky property can be set as overall the Command Bar properties, it applies to the primary Command Area.
CommandbarOverflowPresenter changes the style of the Secondary command style.
Example
CommandBarOverflowPresenter
- <CommandBar.CommandBarOverflowPresenterStyle>
- <Style TargetType="CommandBarOverflowPresenter">
- <Setter Property="Background" Value="Red"/>
- <Setter Property="FontSize" Value="25"/>
- </Style>
- </CommandBar.CommandBarOverflowPresenterStyle>
Note
Microsoft has recommended in Windows 10 programming to use the Command Bar instead of the App bar control.
Summary
In this article, we learned about the Command Bar in UAP in Windows.

Vinoth RajendranPosted Aug 27, 2015, 11:14 AM
Thanks folks
Vaikesh K PPosted Aug 25, 2015, 1:40 AM
Good One
Karthikeyan KPosted Aug 23, 2015, 11:25 PM
Good one sir..Thanks for share
Gopi ChandPosted Aug 23, 2015, 1:55 PM
Its nice one to start with :)
Gowtham KPosted Aug 23, 2015, 1:40 PM
Good one
Vinoth RajendranPosted Aug 23, 2015, 11:27 AM
Thanks santhakumar
Santhakumar MunuswamyPosted Aug 23, 2015, 11:25 AM
Welcome
Santhakumar MunuswamyPosted Aug 23, 2015, 11:18 AM
Good Start
Vinoth RajendranPosted Aug 23, 2015, 6:56 AM
Thanks folks
Sibeesh VenuPosted Aug 23, 2015, 3:46 AM
Nice Share
RakeshPosted Aug 23, 2015, 3:33 AM
Good one
Rajeesh MenothPosted Aug 23, 2015, 2:41 AM
Nice Share