我是 WPF 的新手,我正在玩功能区控件。我有三个不同的功能区选项卡,如下面的代码所示。我正在使用相同的收费栏按钮。如下所示,我编写的方式似乎不是内存最佳方法。任何人都可以帮助修改代码,以便我可以在所有功能区选项卡中使用相同的工具栏而不重复?
<ribbon:RibbonTab x:Name="HomeTab"
Header="Home">
<ribbon:RibbonGroup x:Name="Group1"
Header="">
<ribbon:RibbonButton x:Name="Update1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Update" />
<ribbon:RibbonButton x:Name="Register1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Register" />
<ribbon:RibbonButton x:Name="Uninstall1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Uninstall" />
<ribbon:RibbonButton x:Name="Invisible1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Go invisible" Click="Invisible_Click"/>
<ribbon:RibbonButton x:Name="Help1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Help" />
<ribbon:RibbonButton x:Name="Quit1"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Quit" Click="Quit_Click"/>
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
<ribbon:RibbonTab x:Name="LogTab"
Header="Log History">
<ribbon:RibbonGroup x:Name="Group11"
Header="">
<ribbon:RibbonButton x:Name="Update2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Update" />
<ribbon:RibbonButton x:Name="Regiter2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Register" />
<ribbon:RibbonButton x:Name="Uninstall2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Uninstall" />
<ribbon:RibbonButton x:Name="Invisible2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Go invisible" Click="Invisible_Click"/>
<ribbon:RibbonButton x:Name="Help2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Help" />
<ribbon:RibbonButton x:Name="Quit2"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Quit" Click="Quit_Click" />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
<ribbon:RibbonTab x:Name="SettingsTab"
Header="Settings">
<ribbon:RibbonGroup x:Name="Group21"
Header="">
<ribbon:RibbonButton x:Name="Update3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Update" />
<ribbon:RibbonButton x:Name="Register3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Register" />
<ribbon:RibbonButton x:Name="Uninstall3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Uninstall" />
<ribbon:RibbonButton x:Name="Invisible3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Go invisible" Click="Invisible_Click" />
<ribbon:RibbonButton x:Name="Help3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Help" />
<ribbon:RibbonButton x:Name="Quit3"
LargeImageSource="/T-Spy;component/Resources/favicon.ico"
Label="Quit" Click="Quit_Click"/>
</ribbon:RibbonGroup>
</ribbon:RibbonTab>