skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class WindowBase

Base class for creating a custom Window.

Inheritance
System.Object
WindowBase
DialogWindowBase
ToolWindow
RadWindow
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Navigation.dll

Syntax

public abstract class WindowBase : HeaderedContentControl, INotifyLayoutChange, IWindowDragAware, IDragAware, IClickAware

Constructors

WindowBase()

Initializes a new instance of the WindowBase class.

Declaration
protected WindowBase()

Fields

CanCloseProperty

Identifies the CanClose Property.

Declaration
public static readonly DependencyProperty CanCloseProperty
Field Value
System.Windows.DependencyProperty

CanMoveProperty

Identifies the CanMove Property.

Declaration
public static readonly DependencyProperty CanMoveProperty
Field Value
System.Windows.DependencyProperty

CaptionHeightProperty

Identifies the CaptionHeight dependency property.

Declaration
public static readonly DependencyProperty CaptionHeightProperty
Field Value
System.Windows.DependencyProperty

CornerRadiusProperty

Identifies the CornerRadius dependency property.

Declaration
public static readonly DependencyProperty CornerRadiusProperty
Field Value
System.Windows.DependencyProperty

HideMaximizeButtonProperty

Identifies the HideMaximizeButton dependency property.

Declaration
public static readonly DependencyProperty HideMaximizeButtonProperty
Field Value
System.Windows.DependencyProperty

HideMinimizeButtonProperty

Identifies the HideMinimizeButton dependency property.

Declaration
public static readonly DependencyProperty HideMinimizeButtonProperty
Field Value
System.Windows.DependencyProperty

IsActiveWindowProperty

Identifies the IsActiveWindow Property.

Declaration
public static readonly DependencyProperty IsActiveWindowProperty
Field Value
System.Windows.DependencyProperty

IsDraggingProperty

Identifies the IsDragging Property.

Declaration
public static readonly DependencyProperty IsDraggingProperty
Field Value
System.Windows.DependencyProperty

IsInActiveStateProperty

Identifies the RenderActive Property.

Declaration
public static readonly DependencyProperty IsInActiveStateProperty
Field Value
System.Windows.DependencyProperty

IsModalProperty

Identifies the IsModal Property.

Declaration
public static readonly DependencyProperty IsModalProperty
Field Value
System.Windows.DependencyProperty

IsOpenProperty

Identifies the IsOpen Property.

Declaration
public static readonly DependencyProperty IsOpenProperty
Field Value
System.Windows.DependencyProperty

IsResizingProperty

Identifies the IsResizing Property.

Declaration
public static readonly DependencyProperty IsResizingProperty
Field Value
System.Windows.DependencyProperty

IsTopmostProperty

Identifies the IsTopmost dependency property.

Declaration
public static readonly DependencyProperty IsTopmostProperty
Field Value
System.Windows.DependencyProperty

LeftProperty

Identifies the Left dependency property.

Declaration
public static readonly DependencyProperty LeftProperty
Field Value
System.Windows.DependencyProperty

ResizeBorderProperty

Identifies the ResizeBorder dependency property.

Declaration
public static readonly DependencyProperty ResizeBorderProperty
Field Value
System.Windows.DependencyProperty

ResizeModeProperty

Identifies the ResizeMode dependency property.

Declaration
public static readonly DependencyProperty ResizeModeProperty
Field Value
System.Windows.DependencyProperty

SizeToContentProperty

Identifies the SizeToContent dependency property.

Declaration
public static readonly DependencyProperty SizeToContentProperty
Field Value
System.Windows.DependencyProperty

TopProperty

Identifies the Top dependency property.

Declaration
public static readonly DependencyProperty TopProperty
Field Value
System.Windows.DependencyProperty

WindowStateProperty

Identifies the WindowState dependency property.

Declaration
public static readonly DependencyProperty WindowStateProperty
Field Value
System.Windows.DependencyProperty

Properties

CanClose

Gets or sets whether WindowBase can be closed. This is a dependency property.

Declaration
public bool CanClose { get; set; }
Property Value
System.Boolean

True if this instance can be closed; false otherwise.

Remarks

If the value of this property is true, the instance cannot be closed and the Close button is hidden; otherwise it can be closed.

CanMove

Gets or sets whether WindowBase can be dragged. This is a dependency property.

Declaration
public bool CanMove { get; set; }
Property Value
System.Boolean

True if this instance can be dragged; otherwise, false.

Remarks

If the value of this property is true, the instance can be dragged; otherwise it is is fixed.

CaptionHeight

The extent of the top of the window to treat as the caption.

Declaration
public double CaptionHeight { get; set; }
Property Value
System.Double

CornerRadius

Gets or sets the CornerRadius property.

Declaration
public CornerRadius CornerRadius { get; set; }
Property Value
System.Windows.CornerRadius

HideMaximizeButton

Gets or sets the visibility of the Maximize button.

Declaration
public bool HideMaximizeButton { get; set; }
Property Value
System.Boolean

HideMinimizeButton

Gets or sets the visibility of the Minimize button.

Declaration
public bool HideMinimizeButton { get; set; }
Property Value
System.Boolean

IsActiveWindow

Gets a value indicating whether this instance is active. This is a dependency property.

Declaration
public bool IsActiveWindow { get; }
Property Value
System.Boolean

True if this instance is active; otherwise, false.

IsDragging

Gets a value indicating whether this instance is dragging. This is a dependency property.

Declaration
public bool IsDragging { get; protected set; }
Property Value
System.Boolean

True if this instance is is dragging; otherwise, false.

IsInActiveState

Gets a value indicating whether this instance should appear active. It is not necessary equal to IsActiveWindow. This is a read only dependency property.

Declaration
public bool IsInActiveState { get; }
Property Value
System.Boolean

IsLayoutChanging

Gets a value indicating whether this instance is layout changing.

Declaration
public bool IsLayoutChanging { get; }
Property Value
System.Boolean

True if this instance is layout changing; otherwise, false.

Implements
INotifyLayoutChange.IsLayoutChanging

IsModal

Gets a value that represents whether the WindowBase is modal. This is a dependency property.

Declaration
public bool IsModal { get; }
Property Value
System.Boolean

IsOpen

Gets a value that represents whether the WindowBase is open. This is a dependency property.

Declaration
public bool IsOpen { get; protected set; }
Property Value
System.Boolean

IsResizing

Gets a value indicating whether this instance is resizing. This is a dependency property.

Declaration
public bool IsResizing { get; protected set; }
Property Value
System.Boolean

True if this instance is resizing;false otherwise.

IsTopmost

Gets or sets whether the WindowBase is on top.

Declaration
public bool IsTopmost { get; set; }
Property Value
System.Boolean

Left

Gets or sets a value that represents the distance between the left side of an element and the left side of the page. This is a dependency property.

Declaration
public double Left { get; set; }
Property Value
System.Double

Owner

Gets or sets the Owner of the WindowBase.

Declaration
public ContentControl Owner { get; set; }
Property Value
System.Windows.Controls.ContentControl

ResizeBorder

Get the bounds of the resize grips on the Window.

Declaration
public Thickness ResizeBorder { get; set; }
Property Value
System.Windows.Thickness

ResizeMode

Gets or sets a ResizeMode value for the WindowBase. This is a dependency property.

Declaration
public ResizeMode ResizeMode { get; set; }
Property Value
System.Windows.ResizeMode

SizeToContent

The value of this property is ignored if the Width and Height properties are set.

Declaration
public bool SizeToContent { get; set; }
Property Value
System.Boolean

Top

Gets or sets a value that represents the distance between the top of an element and the top of the page. This is a dependency property.

Declaration
public double Top { get; set; }
Property Value
System.Double

WindowState

Gets or sets a WindowBase value for the WindowBase. This is a dependency property.

Declaration
public WindowState WindowState { get; set; }
Property Value
System.Windows.WindowState

Methods

BringToFront()

Attempts to bring the WindowBase over any other WindowBases except topmost.

Declaration
public void BringToFront()
Remarks

Whenever opened WindowBase automatically appears over any other windows except topmost.

ChangeVisualState()

Updates the visual state of the control.

Declaration
protected void ChangeVisualState()

ChangeVisualState(Boolean)

Updates the visual state of the control.

Declaration
protected virtual void ChangeVisualState(bool useTransitions)
Parameters
System.Boolean useTransitions

Indicates whether transitions should be used.

CheckCanClose()

Checks whether the window can be closed. This method doesn't consider the CanClose property, but checked for some other kind of constraints.

Declaration
protected virtual bool CheckCanClose()
Returns
System.Boolean

True if the window can be changed; false otherwise.

Close()

Manually closes WindowBase.

Declaration
public void Close()
Remarks

Raises Closing and Closed events consequently.

Examples
WindowBase window = new WindowBase();
window.Height = 100;
window.Width = 100;
window.Header = "WindowBase";
window.Content = "This is your content";
window.Show();
window.Close();
Dim window As WindowBase = New WindowBase
window.Height = 100
window.Width = 100
window.Header = "WindowBase"
window.Content = "This is your content"
window.Show()
window.Close()

CloseWithoutEventsAndAnimations()

Closes the Window instantly and the closing cannot be interrupted.

Declaration
protected void CloseWithoutEventsAndAnimations()

GetApplicationSize()

Gets the application size depending on the platform.

Declaration
protected Size GetApplicationSize()
Returns
System.Windows.Size

GetNormalSizeAndPosition()

Gets the size and position of the WindowBase in its normal state.

Declaration
public Rect GetNormalSizeAndPosition()
Returns
System.Windows.Rect

A rectangle with the Left, Top, Width and Height properties of the WindowBase in normal state.

GetWindowOwner()

Declaration
protected virtual ContentControl GetWindowOwner()
Returns
System.Windows.Controls.ContentControl

GetWindowOwnerHandle()

Declaration
protected virtual IntPtr GetWindowOwnerHandle()
Returns
System.IntPtr

GetWindowStartupLocation()

Declaration
protected virtual WindowStartupLocation GetWindowStartupLocation()
Returns
System.Windows.WindowStartupLocation

GetZIndex()

Declaration
public virtual int GetZIndex()
Returns
System.Int32

OnActivated(EventArgs)

Raises the Activated event. This method is called when the window is activated.

Declaration
protected virtual void OnActivated(EventArgs e)
Parameters
System.EventArgs e

The System.EventArgs instance containing the event data.

OnCloseAnimationFinished()

Declaration
protected virtual void OnCloseAnimationFinished()

OnClosed()

Declaration
protected virtual void OnClosed()

OnClosing()

Declaration
protected virtual bool OnClosing()
Returns
System.Boolean

OnCreateAutomationPeer()

Create the automation peer for this class.

Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
System.Windows.Automation.Peers.AutomationPeer

OnDeactivated(EventArgs)

Raises the Deactivated event. This method is called when the window is deactivated.

Declaration
protected virtual void OnDeactivated(EventArgs e)
Parameters
System.EventArgs e

The System.EventArgs instance containing the event data.

OnDragDelta(Point, Rect, Rect, Boolean)

Declaration
protected virtual Rect OnDragDelta(Point globalMousePosition, Rect initialRect, Rect destinationRect, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Windows.Rect initialRect

System.Windows.Rect destinationRect

System.Boolean isResize

Returns
System.Windows.Rect

OnDragEnd(Point, Boolean, Boolean)

Declaration
protected virtual void OnDragEnd(Point globalMousePosition, bool isCancel, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Boolean isCancel

System.Boolean isResize

OnDragStart(Point, Boolean)

Declaration
protected virtual void OnDragStart(Point globalMousePosition, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Boolean isResize

OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)

Invoked when an unhandled System.Windows.Input.Keyboard.GotKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

Declaration
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
System.Windows.Input.KeyboardFocusChangedEventArgs e

The System.Windows.Input.KeyboardFocusChangedEventArgs that contains the event data.

OnHostCreated(HostWindowCreatedEventArgs)

Raises the HostCreated event.

Declaration
protected virtual void OnHostCreated(HostWindowCreatedEventArgs args)
Parameters
HostWindowCreatedEventArgs args

The HostWindowCreatedEventArgs instance containing the event data.

OnLayoutChangeEnded()

Declaration
protected void OnLayoutChangeEnded()

OnLayoutChangeEnded(EventArgs)

Raises the LayoutChangeEnded event.

Declaration
protected virtual void OnLayoutChangeEnded(EventArgs args)
Parameters
System.EventArgs args

The System.EventArgs instance containing the event data.

OnLayoutChangeStarted()

Declaration
protected void OnLayoutChangeStarted()

OnLayoutChangeStarted(EventArgs)

Raises the LayoutChangeStarted event.

Declaration
protected virtual void OnLayoutChangeStarted(EventArgs args)
Parameters
System.EventArgs args

The System.EventArgs instance containing the event data.

OnLocationChanged(EventArgs)

Raises the LocationChanged event.

Declaration
protected virtual void OnLocationChanged(EventArgs args)
Parameters
System.EventArgs args

The System.Windows.RoutedEventArgs instance containing the event data.

OnRightMouseButtonUp()

Declaration
protected virtual void OnRightMouseButtonUp()

OnRootVisualSizeChanged()

Declaration
protected virtual void OnRootVisualSizeChanged()

OnShowAnimationFinished()

Declaration
protected virtual void OnShowAnimationFinished()

OnWindowStateChanged(EventArgs)

Raises the WindowStateChanged event.

Declaration
protected virtual void OnWindowStateChanged(EventArgs args)
Parameters
System.EventArgs args

The System.Windows.RoutedEventArgs instance containing the event data.

ShouldActivate()

Indicates whether the Window should be activated when the focus goes to it.

Declaration
protected virtual bool ShouldActivate()
Returns
System.Boolean

ShouldActivateOnShow()

Declaration
protected virtual bool ShouldActivateOnShow()
Returns
System.Boolean

ShouldFocusOnActivate()

Declaration
protected virtual bool ShouldFocusOnActivate()
Returns
System.Boolean

ShouldShowInTaskSwitcher()

Indicates whether the Window should be present in the Task Switcher (Alt+Tab) menu of the Windows. In order to hide it correctly, the Window shouldn't be shown in the taskbar (ShowInTaskbar property should be false).

Declaration
protected virtual bool ShouldShowInTaskSwitcher()
Returns
System.Boolean

ShouldSystemMenuOnRightClick()

When overridden in the derived class this methods returns value that determines whether the system menu should be shown when the user right-clicks the header of the WindowBase control.

Declaration
protected virtual bool ShouldSystemMenuOnRightClick()
Returns
System.Boolean

ShowWindow(Boolean)

Shows the window either modally or not. This method should be used in the subclasses to open the window.

Declaration
protected virtual void ShowWindow(bool isModal)
Parameters
System.Boolean isModal

Whether the window is modal or not.

Events

Activated

Occurs when the Window is activated.

Declaration
public event EventHandler Activated
Event Type
System.EventHandler

Deactivated

Occurs when the Window is deactivated.

Declaration
public event EventHandler Deactivated
Event Type
System.EventHandler

LayoutChangeEnded

Occurs when a layout change is ended.

Declaration
public event EventHandler LayoutChangeEnded
Event Type
System.EventHandler

Implements
INotifyLayoutChange.LayoutChangeEnded

LayoutChangeStarted

Occurs when a layout change is started.

Declaration
public event EventHandler LayoutChangeStarted
Event Type
System.EventHandler

Implements
INotifyLayoutChange.LayoutChangeStarted

LocationChanged

Occurs when the value of a Left or Top changes.

Declaration
[SRCategory("Behavior")]
public event EventHandler LocationChanged
Event Type
System.EventHandler

WindowStateChanged

Occurs when the value of a WindowState changes.

Declaration
[SRCategory("Behavior")]
public event EventHandler WindowStateChanged
Event Type
System.EventHandler

Remarks

The event is raised whenever the WindowState property is changed.

Explicit Interface Implementations

IDragAware.OnDragDelta(Point, Rect, Rect, Boolean)

Declaration
Rect IDragAware.OnDragDelta(Point globalMousePosition, Rect initialRect, Rect destinationRect, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Windows.Rect initialRect

System.Windows.Rect destinationRect

System.Boolean isResize

Returns
System.Windows.Rect

Implements
IDragAware.OnDragDelta(Point, Rect, Rect, Boolean)

IDragAware.OnDragEnd(Point, Boolean, Boolean)

Declaration
void IDragAware.OnDragEnd(Point globalMousePosition, bool isCancel, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Boolean isCancel

System.Boolean isResize

Implements
IDragAware.OnDragEnd(Point, Boolean, Boolean)

IDragAware.OnDragStart(Point, Boolean)

Declaration
void IDragAware.OnDragStart(Point globalMousePosition, bool isResize)
Parameters
System.Windows.Point globalMousePosition

System.Boolean isResize

Implements
IDragAware.OnDragStart(Point, Boolean)

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.