我有一个fluent.ribbon,它具有剪切,复制和粘贴传统按钮的功能,并尝试连接到相应的ApplicationCommands。但是,这些按钮已被禁用,并且不能像将它们放在菜单中时。如何在fluent.ribbon中使用ApplicationCommands?
这些命令可以与菜单项。
<Fluent:RibbonGroupBox Header="Clipboard">
<Fluent:Button Header="Paste" Command="ApplicationCommands.Paste" Icon="./Assets/Paste_96x.png" LargeIcon="./Assets/Paste_96x.png"/>
<Fluent:Button Header="Copy" Command="ApplicationCommands.Copy" SizeDefinition="Middle" Icon="./Assets/Copy_96x.png" LargeIcon="./Assets/Copy_32x.png"/>
<Fluent:Button Header="Cut" Command="ApplicationCommands.Cut" SizeDefinition="Middle" Icon="./Assets/Cut_96x.png" LargeIcon="./Assets/Cut_96x.png"/>
</Fluent:RibbonGroupBox>
答案 0 :(得分:0)
使用FocusManager可以达到目的。
<Fluent:RibbonGroupBox Header="Clipboard">
<Fluent:Button Header="Paste" Command="ApplicationCommands.Paste" FocusManager.IsFocusScope="True" Icon="./Assets/Paste_96x.png" LargeIcon="./Assets/Paste_96x.png"/>
<Fluent:Button Header="Copy" Command="ApplicationCommands.Copy" FocusManager.IsFocusScope="True" SizeDefinition="Middle" Icon="./Assets/Copy_96x.png" LargeIcon="./Assets/Copy_32x.png"/>
<Fluent:Button Header="Cut" Command="ApplicationCommands.Cut" FocusManager.IsFocusScope="True" SizeDefinition="Middle" Icon="./Assets/Cut_96x.png" LargeIcon="./Assets/Cut_96x.png"/>
</Fluent:RibbonGroupBox>