BinaryRibbonWindow
A custom Window class that provides Office emulating window display.
public partial class BinaryRibbonWindow : Window
Inherits from / implements: Window
Remarks
How this control works. The window draws its own frame: the title bar, the caption buttons, the quick access toolbar and the border are all in its template, and the whole window is client area. Its window procedure answers WM_NCCALCSIZE to give the caption rows to the client, WM_NCHITTEST so that the template's title bar drags and its edges resize, and asks for the rows it took back to be repainted; while it draws its own chrome it also tells the desktop window manager not to draw a system caption over it. The handle can change. A window handle can be recreated (a state change can do it), so the window procedure hook and the frame settings are applied to each handle as it appears, not once per window. Icons set with WM_SETICON go through to default processing, which is what keeps the taskbar icon across maximise and restore. Skins and backdrop. The frame takes its colours from the ribbon's skin resources; under a Fluent skin on Windows 11 it can let Mica show through and tells the frame whether the skin is light or dark. The ribbon display options button in the title bar is in the DisplayOptions partial. Right to left mirrors the window's content while the window itself stays left to right, so its handle is never mirrored.
Members at a glance
BinaryRibbonWindow | Initializes a new instance of the BinaryRibbonWindow class. |
ApplicationMenuButtonRenderingStyle | Gets or sets the application menu button rendering style. |
CloseWindow | Gets the CloseWindow routed UI command instance. |
CurrentlyRenderingGlassOnNCArea | Gets or sets a value indicating whether currently extending glass on to the Window frame. |
EnableDropShadowEffectOnWindowControlButtons | Gets or sets a value indicating whether to enable drop shadow effect on window control buttons - i.e. Minimize, Maximize and Close buttons. |
GlassCaptionBrush | Gets the brush the glass template fills its caption area with when the operating system has no material of its own to put there, or null when it has. |
IsFlowDirectionRightToLeft | Gets or sets whether the window is laid out right to left, for Arabic, Hebrew, Persian and the other right-to-left languages. |
IsRibbonWindowActiveAndCurrent | Gets or sets a value indicating whether this instance is active and current. |
IsWindowControlButtonsVisible | Gets or sets a value indicating whether the window control buttons are visible or not - i.e. the Minimize, Maximise and Close button. |
MaximizeWindow | Gets the Maximize routed UI command instance. |
MinimizeWindow | Gets the MinimizeWindow routed UI command instance. |
QATPanelHeight | The height of the quick access toolbar panel. |
QATPanelMargin | The margin left around the quick access toolbar panel. |
RenderGlassIfOSSupports | Gets or sets a value indicating whether to render Vista / Windows 7 Aero glass in the non-client areas, if the current OS supports. |
ScaleTransformScaleXAndScaleY | Gets or sets the scale transform's scale X and scale Y values. |
TitleBarMargin | The margin left around the title bar, which is how the caption is kept clear of the window's own chrome. |
TitleBrush | Gets or sets the Window title brush. |
WindowBorderEdgeRenderingMode | Gets or sets the window border edge rendering mode. |
WindowTitleBarBackgroundRenderingStyle | Gets or sets the window title bar background rendering style. |
ArrangeOverride | Places the children within the space this element was given, and reports the space it actually used. |
GetIsHitTestVisibleInChrome | Gets whether an element in the window's caption takes the pointer rather than letting the window be dragged. |
OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. |
OnClosed | Called when the window has closed; stops listening for skin changes. |
OnContentChanged | Called when the window's content changes; new content takes the window's direction. |
OnDpiChanged | Raises the DpiChanged event, and puts the glass frame back at the new scale. |
OnSizeChanged | Called when the window is resized, which is where the ribbon is told to reconsider how much of itself it can show. |
OnSourceInitialized | Raises the SourceInitialized event. BinaryRibbonWindow overrides it so the control's own handling runs alongside the base behavior. |
OnStateChanged | Raises the StateChanged event. BinaryRibbonWindow overrides it so the control's own handling runs alongside the base behavior. |
SetIsHitTestVisibleInChrome | Sets whether an element in the window's caption takes the pointer rather than letting the window be dragged. |
WndProc | Processes the Windows messages sent to this control's window. |
ApplicationMenuButtonRenderingStyleProperty | Identifies the ApplicationMenuButtonRenderingStyle dependency property. |
CurrentlyRenderingGlassOnNCAreaProperty | CurrentlyRenderingGlassOnNCAreaProperty property. |
EnableDropShadowEffectOnWindowControlButtonsProperty | EnableDropShadowEffectOnWindowControlButtonsProperty property. |
GlassCaptionBrushProperty | Identifies the GlassCaptionBrush dependency property. |
IsFlowDirectionRightToLeftProperty | Identifies the IsFlowDirectionRightToLeft dependency property. |
IsHitTestVisibleInChromeProperty | Identifies the IsHitTestVisibleInChrome attached property. |
IsWindowActiveAndCurrentProperty | IsWindowActiveAndCurrentProperty property. |
IsWindowControlButtonsVisibleProperty | IsWindowControlButtonsVisibleProperty property. |
QATPanelHeightProperty | Identifies the QATPanelHeight dependency property. |
QATPanelMarginProperty | Identifies the QATPanelMargin dependency property. |
RenderGlassIfOSSupportsProperty | RenderGlassIfOSSupportsProperty property. |
ScaleTransformScaleXAndScaleYProperty | Identifies the ScaleTransformScaleXAndScaleY dependency property. |
TitleBarMarginProperty | Identifies the TitleBarMargin dependency property. |
TitleBrushProperty | TitleBrushProperty property. |
WindowBorderEdgeRenderingModeProperty | WindowBorderEdgeRenderingModeProperty property. |
WindowTitleBarBackgroundRenderingStyleProperty | Identifies the WindowTitleBarBackgroundRenderingStyle dependency property. |
Constructors
BinaryRibbonWindow
Initializes a new instance of the BinaryRibbonWindow class.
Properties
CloseWindow
Gets the CloseWindow routed UI command instance.
CurrentlyRenderingGlassOnNCArea
Gets or sets a value indicating whether currently extending glass on to the Window frame.
EnableDropShadowEffectOnWindowControlButtons
Gets or sets a value indicating whether to enable drop shadow effect on window control buttons - i.e. Minimize, Maximize and Close buttons.
GlassCaptionBrush
Gets the brush the glass template fills its caption area with when the operating system has no material of its own to put there, or null when it has.
IsFlowDirectionRightToLeft
Gets or sets whether the window is laid out right to left, for Arabic, Hebrew, Persian and the other right-to-left languages.
Value. true for right to left. The default is false .
FlowDirection on its Content, and takes it off again when this is turned off or the content is replaced. Use this rather than setting FlowDirection on the window itself: that mirrors the window handle as well, and this window draws its own caption. Glass is not drawn while the window is right to left, because a glass frame's caption buttons are the system's and stay at the right; it comes back when the window returns to left to right, if RenderGlassIfOSSupports is still set.IsRibbonWindowActiveAndCurrent
Gets or sets a value indicating whether this instance is active and current.
IsWindowControlButtonsVisible
Gets or sets a value indicating whether the window control buttons are visible or not - i.e. the Minimize, Maximise and Close button.
MaximizeWindow
Gets the Maximize routed UI command instance.
MinimizeWindow
Gets the MinimizeWindow routed UI command instance.
QATPanelHeight
The height of the quick access toolbar panel.
QATPanelMargin
The margin left around the quick access toolbar panel.
RenderGlassIfOSSupports
Gets or sets a value indicating whether to render Vista / Windows 7 Aero glass in the non-client areas, if the current OS supports.
ScaleTransformScaleXAndScaleY
Gets or sets the scale transform's scale X and scale Y values.
TitleBarMargin
The margin left around the title bar, which is how the caption is kept clear of the window's own chrome.
TitleBrush
Gets or sets the Window title brush.
WindowBorderEdgeRenderingMode
Gets or sets the window border edge rendering mode.
WindowTitleBarBackgroundRenderingStyle
Gets or sets the window title bar background rendering style.
WindowTitleBarBackgroundRenderingStyleMethods
ArrangeOverride
Places the children within the space this element was given, and reports the space it actually used.
GetIsHitTestVisibleInChrome
Gets whether an element in the window's caption takes the pointer rather than letting the window be dragged.
- element
- The element.
Returns. true if the element answers clicks of its own.
OnApplyTemplate
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.
OnClosed
Called when the window has closed; stops listening for skin changes.
- e
- Not used.
OnContentChanged
Called when the window's content changes; new content takes the window's direction.
- oldContent
- The content that was there.
- newContent
- The content now there.
OnDpiChanged
Raises the DpiChanged event, and puts the glass frame back at the new scale.
- oldDpi
- The scale before the change.
- newDpi
- The scale after it.
OnSizeChanged
Called when the window is resized, which is where the ribbon is told to reconsider how much of itself it can show.
- sender
- The window.
- e
- The old and new sizes.
OnSourceInitialized
Raises the SourceInitialized event. BinaryRibbonWindow overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnStateChanged
Raises the StateChanged event. BinaryRibbonWindow overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
SetIsHitTestVisibleInChrome
Sets whether an element in the window's caption takes the pointer rather than letting the window be dragged.
- element
- The element.
- value
- true if the element answers clicks of its own.
WndProc
Processes the Windows messages sent to this control's window.
Fields
CurrentlyRenderingGlassOnNCAreaProperty
CurrentlyRenderingGlassOnNCAreaProperty property.
EnableDropShadowEffectOnWindowControlButtonsProperty
EnableDropShadowEffectOnWindowControlButtonsProperty property.
GlassCaptionBrushProperty
Identifies the GlassCaptionBrush dependency property.
IsFlowDirectionRightToLeftProperty
Identifies the IsFlowDirectionRightToLeft dependency property.
IsHitTestVisibleInChromeProperty
Identifies the IsHitTestVisibleInChrome attached property.
IsWindowActiveAndCurrentProperty
IsWindowActiveAndCurrentProperty property.
IsWindowControlButtonsVisibleProperty
IsWindowControlButtonsVisibleProperty property.
QATPanelHeightProperty
Identifies the QATPanelHeight dependency property.
QATPanelMarginProperty
Identifies the QATPanelMargin dependency property.
RenderGlassIfOSSupportsProperty
RenderGlassIfOSSupportsProperty property.
ScaleTransformScaleXAndScaleYProperty
Identifies the ScaleTransformScaleXAndScaleY dependency property.
TitleBarMarginProperty
Identifies the TitleBarMargin dependency property.
TitleBrushProperty
TitleBrushProperty property.
WindowBorderEdgeRenderingModeProperty
WindowBorderEdgeRenderingModeProperty property.
WindowTitleBarBackgroundRenderingStyleProperty
Identifies the WindowTitleBarBackgroundRenderingStyle dependency property.