New to Telerik UI for WPFStart a free 30-day trial

Base class for creating a custom Window.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.Navigation.dll

Syntax:

C#
public abstract class WindowBase : HeaderedContentControl, INotifyLayoutChange, IDragAware

Inheritance: objectWindowBase

Derived Classes: DialogWindowBaseToolWindowRadWindow

Implements: IDragAwareINotifyLayoutChange

Constructors

Initializes a new instance of the WindowBase class.

C#
protected WindowBase()

Fields

CanCloseProperty

DependencyProperty

Identifies the CanClose Property.

C#
public static readonly DependencyProperty CanCloseProperty

CanMoveProperty

DependencyProperty

Identifies the CanMove Property.

C#
public static readonly DependencyProperty CanMoveProperty

CaptionHeightProperty

DependencyProperty

Identifies the CaptionHeight dependency property.

C#
public static readonly DependencyProperty CaptionHeightProperty

CornerRadiusProperty

DependencyProperty

Identifies the CornerRadius dependency property.

C#
public static readonly DependencyProperty CornerRadiusProperty

HideMaximizeButtonProperty

DependencyProperty

Identifies the HideMaximizeButton dependency property.

C#
public static readonly DependencyProperty HideMaximizeButtonProperty

HideMinimizeButtonProperty

DependencyProperty

Identifies the HideMinimizeButton dependency property.

C#
public static readonly DependencyProperty HideMinimizeButtonProperty

IsActiveWindowProperty

DependencyProperty

Identifies the IsActiveWindow Property.

C#
public static readonly DependencyProperty IsActiveWindowProperty

IsDraggingProperty

DependencyProperty

Identifies the IsDragging Property.

C#
public static readonly DependencyProperty IsDraggingProperty

IsInActiveStateProperty

DependencyProperty

Identifies the RenderActive Property.

C#
public static readonly DependencyProperty IsInActiveStateProperty

IsModalProperty

DependencyProperty

Identifies the IsModal Property.

C#
public static readonly DependencyProperty IsModalProperty

IsOpenProperty

DependencyProperty

Identifies the IsOpen Property.

C#
public static readonly DependencyProperty IsOpenProperty

IsResizingProperty

DependencyProperty

Identifies the IsResizing Property.

C#
public static readonly DependencyProperty IsResizingProperty

IsTopmostProperty

DependencyProperty

Identifies the IsTopmost dependency property.

C#
public static readonly DependencyProperty IsTopmostProperty

LeftProperty

DependencyProperty

Identifies the Left dependency property.

C#
public static readonly DependencyProperty LeftProperty

ResizeBorderProperty

DependencyProperty

Identifies the ResizeBorder dependency property.

C#
public static readonly DependencyProperty ResizeBorderProperty

ResizeModeProperty

DependencyProperty

Identifies the ResizeMode dependency property.

C#
public static readonly DependencyProperty ResizeModeProperty

SizeToContentProperty

DependencyProperty

Identifies the SizeToContent dependency property.

C#
public static readonly DependencyProperty SizeToContentProperty

TopProperty

DependencyProperty

Identifies the Top dependency property.

C#
public static readonly DependencyProperty TopProperty

WindowStateProperty

DependencyProperty

Identifies the WindowState dependency property.

C#
public static readonly DependencyProperty WindowStateProperty

Properties

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

C#
public bool CanClose { get; set; }
Property Value:

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.

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

C#
public bool CanMove { get; set; }
Property Value:

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.

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

C#
public double CaptionHeight { get; set; }

CornerRadius

CornerRadius

Gets or sets the CornerRadius property.

C#
public CornerRadius CornerRadius { get; set; }

Gets or sets the visibility of the Maximize button.

C#
public bool HideMaximizeButton { get; set; }

Gets or sets the visibility of the Minimize button.

C#
public bool HideMinimizeButton { get; set; }

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

C#
public bool IsActiveWindow { get; }
Property Value:

True if this instance is active; otherwise, false.

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

C#
public bool IsDragging { get; protected set; }
Property Value:

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

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

C#
public bool IsInActiveState { get; }

Gets a value indicating whether this instance is layout changing.

C#
public bool IsLayoutChanging { get; }
Property Value:

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

Implements: INotifyLayoutChange.IsLayoutChanging

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

C#
public bool IsModal { get; }

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

C#
public bool IsOpen { get; protected set; }

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

C#
public bool IsResizing { get; protected set; }
Property Value:

True if this instance is resizing;false otherwise.

Gets or sets whether the WindowBase is on top.

C#
public bool IsTopmost { get; set; }

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.

C#
public double Left { get; set; }

Owner

ContentControl

Gets or sets the Owner of the WindowBase.

C#
public ContentControl Owner { get; set; }

ResizeBorder

Thickness

Get the bounds of the resize grips on the Window.

C#
public Thickness ResizeBorder { get; set; }

ResizeMode

ResizeMode

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

C#
public ResizeMode ResizeMode { get; set; }

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

C#
public bool SizeToContent { get; set; }

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.

C#
public double Top { get; set; }

WindowState

WindowState

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

C#
public WindowState WindowState { get; set; }

Methods

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

C#
public void BringToFront()
Remarks:

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

Updates the visual state of the control.

C#
protected void ChangeVisualState()

Updates the visual state of the control.

C#
protected virtual void ChangeVisualState(bool useTransitions)
Parameters:useTransitionsbool

Indicates whether transitions should be used.

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

C#
protected virtual bool CheckCanClose()
Returns:

bool

True if the window can be changed; false otherwise.

Manually closes WindowBase.

C#
public void Close()
Remarks:

Raises Closing and Closed events consequently.

Closes the Window instantly and the closing cannot be interrupted.

C#
protected void CloseWithoutEventsAndAnimations()

Gets the application size depending on the platform.

C#
protected Size GetApplicationSize()
Returns:

Size

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

C#
public Rect GetNormalSizeAndPosition()
Returns:

Rect

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

GetWindowOwner()

ContentControl

Gets the owner of the WindowBase.

C#
protected virtual ContentControl GetWindowOwner()
Returns:

ContentControl

Gets the owner handle of the WindowBase.

C#
protected virtual nint GetWindowOwnerHandle()
Returns:

nint

GetWindowStartupLocation()

WindowStartupLocation

Gets the startup location of the WindowBase.

C#
protected virtual WindowStartupLocation GetWindowStartupLocation()
Returns:

WindowStartupLocation

Gets the z-index of the window, which determines the order in which windows are rendered on the screen.

C#
public virtual int GetZIndex()
Returns:

int

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

C#
protected virtual void OnActivated(EventArgs e)
Parameters:eEventArgs

The EventArgs instance containing the event data.

Closes the host immediately without any animations and events.

C#
protected virtual void OnCloseAnimationFinished()

Closes the host immediately without any animations and events.

C#
protected virtual void OnClosed()

Checks whether the window can be closed and raises the Closing event.

C#
protected virtual bool OnClosing()
Returns:

bool

Create the automation peer for this class.

C#
protected override AutomationPeer OnCreateAutomationPeer()
Returns:

AutomationPeer

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

C#
protected virtual void OnDeactivated(EventArgs e)
Parameters:eEventArgs

The EventArgs instance containing the event data.

Handles the delta of the drag operation.

C#
protected virtual Rect OnDragDelta(Point globalMousePosition, Rect initialRect, Rect destinationRect, bool isResize)
Parameters:globalMousePositionPointinitialRectRectdestinationRectRectisResizeboolReturns:

Rect

Handles the end of the drag operation.

C#
protected virtual void OnDragEnd(Point globalMousePosition, bool isCancel, bool isResize)
Parameters:globalMousePositionPointisCancelboolisResizebool

Handles the start of the drag operation.

C#
protected virtual void OnDragStart(Point globalMousePosition, bool isResize)
Parameters:globalMousePositionPointisResizebool

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.

C#
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters:eKeyboardFocusChangedEventArgs

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

Raises the event.

C#
protected virtual void OnHostCreated(HostWindowCreatedEventArgs args)
Parameters:argsHostWindowCreatedEventArgs

The HostWindowCreatedEventArgs instance containing the event data.

Ends the layout changing scope and raises the event.

C#
protected void OnLayoutChangeEnded()

Raises the event.

C#
protected virtual void OnLayoutChangeEnded(EventArgs args)
Parameters:argsEventArgs

The EventArgs instance containing the event data.

Begins the layout changing scope and raises the event if it is not already active.

C#
protected void OnLayoutChangeStarted()

Raises the event.

C#
protected virtual void OnLayoutChangeStarted(EventArgs args)
Parameters:argsEventArgs

The EventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnLocationChanged(EventArgs args)
Parameters:argsEventArgs

The RoutedEventArgs instance containing the event data.

Closes the host immediately without any animations and events.

C#
protected virtual void OnRightMouseButtonUp()

Updates the position helper and checks the restricted area and updates the rect of the window.

C#
protected virtual void OnRootVisualSizeChanged()

Closes the host immediately without any animations and events.

C#
protected virtual void OnShowAnimationFinished()

Raises the event.

C#
protected virtual void OnWindowStateChanged(EventArgs args)
Parameters:argsEventArgs

The RoutedEventArgs instance containing the event data.

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

C#
protected virtual bool ShouldActivate()
Returns:

bool

Indicates whether the Window should be activated when it is shown.

C#
protected virtual bool ShouldActivateOnShow()
Returns:

bool

Indicates whether the Window should focus when it is activated.

C#
protected virtual bool ShouldFocusOnActivate()
Returns:

bool

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).

C#
protected virtual bool ShouldShowInTaskSwitcher()
Returns:

bool

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.

C#
protected virtual bool ShouldSystemMenuOnRightClick()
Returns:

bool

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

C#
protected virtual void ShowWindow(bool isModal)
Parameters:isModalbool

Whether the window is modal or not.

Events

Occurs when the Window is activated.

C#
public event EventHandler Activated

Occurs when the Window is deactivated.

C#
public event EventHandler Deactivated

Occurs when a layout change is ended.

C#
public event EventHandler LayoutChangeEnded

Implements: INotifyLayoutChange.LayoutChangeEnded

Occurs when a layout change is started.

C#
public event EventHandler LayoutChangeStarted

Implements: INotifyLayoutChange.LayoutChangeStarted

Occurs when the value of a Left or Top changes.

C#
[SRCategory("Behavior")]
public event EventHandler LocationChanged

Occurs when the value of a WindowState changes.

C#
[SRCategory("Behavior")]
public event EventHandler WindowStateChanged
Remarks:

The event is raised whenever the WindowState property is changed.

In this article
DefinitionConstructorsWindowBase()FieldsCanClosePropertyCanMovePropertyCaptionHeightPropertyCornerRadiusPropertyHideMaximizeButtonPropertyHideMinimizeButtonPropertyIsActiveWindowPropertyIsDraggingPropertyIsInActiveStatePropertyIsModalPropertyIsOpenPropertyIsResizingPropertyIsTopmostPropertyLeftPropertyResizeBorderPropertyResizeModePropertySizeToContentPropertyTopPropertyWindowStatePropertyPropertiesCanCloseCanMoveCaptionHeightCornerRadiusHideMaximizeButtonHideMinimizeButtonIsActiveWindowIsDraggingIsInActiveStateIsLayoutChangingIsModalIsOpenIsResizingIsTopmostLeftOwnerResizeBorderResizeModeSizeToContentTopWindowStateMethodsBringToFront()ChangeVisualState()ChangeVisualState(bool)CheckCanClose()Close()CloseWithoutEventsAndAnimations()GetApplicationSize()GetNormalSizeAndPosition()GetWindowOwner()GetWindowOwnerHandle()GetWindowStartupLocation()GetZIndex()OnActivated(EventArgs)OnCloseAnimationFinished()OnClosed()OnClosing()OnCreateAutomationPeer()OnDeactivated(EventArgs)OnDragDelta(Point, Rect, Rect, bool)OnDragEnd(Point, bool, bool)OnDragStart(Point, bool)OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)OnHostCreated(HostWindowCreatedEventArgs)OnLayoutChangeEnded()OnLayoutChangeEnded(EventArgs)OnLayoutChangeStarted()OnLayoutChangeStarted(EventArgs)OnLocationChanged(EventArgs)OnRightMouseButtonUp()OnRootVisualSizeChanged()OnShowAnimationFinished()OnWindowStateChanged(EventArgs)ShouldActivate()ShouldActivateOnShow()ShouldFocusOnActivate()ShouldShowInTaskSwitcher()ShouldSystemMenuOnRightClick()ShowWindow(bool)EventsActivatedDeactivatedLayoutChangeEndedLayoutChangeStartedLocationChangedWindowStateChanged
Not finding the help you need?
Contact Support