How is the Application button and quick access toolbar placement accomplished?
(source: microsoft.com)
first, put a reference to the Ribbon namespace in your xaml...
<r:RibbonWindow
...
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
>
then you can configure your Application menu by binding to a RibbonCommand property on your ViewModel (much the same as you bind your other Ribbon commands)
<r:Ribbon>
<r:Ribbon.ApplicationMenu>
<r:RibbonApplicationMenu
Command="{Binding Path=ApplicationMenuCommand}">
<!-- If your first menu item if 'Open File' -->
<r:RibbonApplicationMenuItem
Command="{Binding Path=OpenFileCommand}" />
</r:RibbonApplicationMenu>
</r:Ribbon.ApplicationMenu>
</r:Ribbon>
where the property looks something like:
public RibbonCommand OpenFileCommand
{
get
{
if (_openFileCommand == null)
{
_openFileCommand = new RibbonCommand("OpenFileCommand", typeof(RibbonApplicationMenuItem));
_openFileCommand.LabelDescription = "Label Description";
_openFileCommand.LabelTitle = "Label Title";
_openFileCommand.ToolTipDescription = "Tooltip Description";
_openFileCommand.ToolTipTitle = "Tooltip Title";
_openFileCommand.CanExecute += (sender, e) => { e.CanExecute = true; };
_openFileCommand.Executed += (sender, e) => { /* logic to open a file goes here... */; };
}
return _openFileCommand;
}
}
For the second part of your question - I'm afraid I haven't played too much with the QuickAccess toolbar yet, but I'm guessing it will start with something like...
<r:Ribbon.QuickAccessToolBar>
<r:RibbonQuickAccessToolBar>
<!-- put your RibbonCommands here -->
</r:RibbonQuickAccessToolBar>
</r:Ribbon.QuickAccessToolBar>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With