'Declaration Public Class RibbonWindowContentHost Inherits System.Windows.Controls.ContentControl
public class RibbonWindowContentHost : System.Windows.Controls.ContentControl
The RibbonWindowContentHost class is designed to be used as the content of the XamRibbonWindow in rich client applications to enable the placement of a XamRibbon in the caption area (i.e., non-client area) of the window. When the XamRibbon is used in a standard System.Windows.Window or on a System.Windows.Controls.Page, it appears inside the bounds of the window’s or page’s client area.
The RibbonWindowContentHost exposes 3 main properties - Ribbon, StatusBar and System.Windows.Controls.ContentControl.Content. The Ribbon property should be set to an instance of a XamRibbon that will be displayed within the caption area of the containing XamRibbonWindow. The StatusBar may optionally be set to a System.Windows.Controls.Primitives.StatusBar that will be displayed at the bottom of the content. The Content property is used to specify the control or element that represents the client area of the window. This property is normally set to a derived System.Windows.Controls.Panel that then contains the controls that make up the main client area of the window.
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