Public Partial Class CodeRibbonWindow Inherits XamRibbonWindow Private xamRibbon As XamRibbon Public Sub New() InitializeComponent() initRibbonItems() End Sub Private Sub initRibbonItems() 'Create RibbonWindowContentHost Dim xamContentHost As New RibbonWindowContentHost() Me.Content = xamContentHost 'Create XamRibbon object xamRibbon = New XamRibbon() xamContentHost.Ribbon = xamRibbon DockPanel.SetDock(xamRibbon, Dock.Top) End Sub End Class
public partial class CodeRibbonWindow : XamRibbonWindow { XamRibbon xamRibbon; public CodeRibbonWindow() { InitializeComponent(); initRibbonItems(); } private void initRibbonItems() { //Create RibbonWindowContentHost RibbonWindowContentHost xamContentHost = new RibbonWindowContentHost(); this.Content = xamContentHost; //Create XamRibbon object xamRibbon = new XamRibbon(); xamContentHost.Ribbon = xamRibbon; DockPanel.SetDock(xamRibbon, Dock.Top); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2