Class
WindowBase

Base class for creating a custom Window.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.Navigation.dll

Syntax:

cs-api-definition
public abstract class WindowBase : HeaderedContentControl, INotifyLayoutChange, IDragAware

Inheritance: objectWindowBase

Derived Classes: DialogWindowBaseToolWindowRadWindow

Implements: IDragAwareINotifyLayoutChange

Constructors

WindowBase()

Initializes a new instance of the WindowBase class.

Declaration

cs-api-definition
protected WindowBase()

Fields

CanCloseProperty

Identifies the CanClose Property.

Declaration

cs-api-definition
public static readonly DependencyProperty CanCloseProperty

Field Value

DependencyProperty

CanMoveProperty

Identifies the CanMove Property.

Declaration

cs-api-definition
public static readonly DependencyProperty CanMoveProperty

Field Value

DependencyProperty

CaptionHeightProperty

Identifies the CaptionHeight dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CaptionHeightProperty

Field Value

DependencyProperty

CornerRadiusProperty

Identifies the CornerRadius dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CornerRadiusProperty

Field Value

DependencyProperty

HideMaximizeButtonProperty

Identifies the HideMaximizeButton dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HideMaximizeButtonProperty

Field Value

DependencyProperty

HideMinimizeButtonProperty

Identifies the HideMinimizeButton dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HideMinimizeButtonProperty

Field Value

DependencyProperty

IsActiveWindowProperty

Identifies the IsActiveWindow Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsActiveWindowProperty

Field Value

DependencyProperty

IsDraggingProperty

Identifies the IsDragging Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsDraggingProperty

Field Value

DependencyProperty

IsInActiveStateProperty

Identifies the RenderActive Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsInActiveStateProperty

Field Value

DependencyProperty

IsModalProperty

Identifies the IsModal Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsModalProperty

Field Value

DependencyProperty

IsOpenProperty

Identifies the IsOpen Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsOpenProperty

Field Value

DependencyProperty

IsResizingProperty

Identifies the IsResizing Property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsResizingProperty

Field Value

DependencyProperty

IsTopmostProperty

Identifies the IsTopmost dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsTopmostProperty

Field Value

DependencyProperty

LeftProperty

Identifies the Left dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty LeftProperty

Field Value

DependencyProperty

ResizeBorderProperty

Identifies the ResizeBorder dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ResizeBorderProperty

Field Value

DependencyProperty

ResizeModeProperty

Identifies the ResizeMode dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ResizeModeProperty

Field Value

DependencyProperty

SizeToContentProperty

Identifies the SizeToContent dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty SizeToContentProperty

Field Value

DependencyProperty

TopProperty

Identifies the Top dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty TopProperty

Field Value

DependencyProperty

WindowStateProperty

Identifies the WindowState dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty WindowStateProperty

Field Value

DependencyProperty

Properties

CanClose

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

Declaration

cs-api-definition
public bool CanClose { get; set; }

Property Value

bool

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

cs-api-definition
public bool CanMove { get; set; }

Property Value

bool

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

cs-api-definition
public double CaptionHeight { get; set; }

Property Value

double

CornerRadius

Gets or sets the CornerRadius property.

Declaration

cs-api-definition
public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

HideMaximizeButton

Gets or sets the visibility of the Maximize button.

Declaration

cs-api-definition
public bool HideMaximizeButton { get; set; }

Property Value

bool

HideMinimizeButton

Gets or sets the visibility of the Minimize button.

Declaration

cs-api-definition
public bool HideMinimizeButton { get; set; }

Property Value

bool

IsActiveWindow

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

Declaration

cs-api-definition
public bool IsActiveWindow { get; }

Property Value

bool

True if this instance is active; otherwise, false.

IsDragging

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

Declaration

cs-api-definition
public bool IsDragging { get; protected set; }

Property Value

bool

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

cs-api-definition
public bool IsInActiveState { get; }

Property Value

bool

IsLayoutChanging

Gets a value indicating whether this instance is layout changing.

Declaration

cs-api-definition
public bool IsLayoutChanging { get; }

Property Value

bool

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

cs-api-definition
public bool IsModal { get; }

Property Value

bool

IsOpen

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

Declaration

cs-api-definition
public bool IsOpen { get; protected set; }

Property Value

bool

IsResizing

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

Declaration

cs-api-definition
public bool IsResizing { get; protected set; }

Property Value

bool

True if this instance is resizing;false otherwise.

IsTopmost

Gets or sets whether the WindowBase is on top.

Declaration

cs-api-definition
public bool IsTopmost { get; set; }

Property Value

bool

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

cs-api-definition
public double Left { get; set; }

Property Value

double

Owner

Gets or sets the Owner of the WindowBase.

Declaration

cs-api-definition
public ContentControl Owner { get; set; }

Property Value

ContentControl

ResizeBorder

Get the bounds of the resize grips on the Window.

Declaration

cs-api-definition
public Thickness ResizeBorder { get; set; }

Property Value

Thickness

ResizeMode

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

Declaration

cs-api-definition
public ResizeMode ResizeMode { get; set; }

Property Value

ResizeMode

SizeToContent

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

Declaration

cs-api-definition
public bool SizeToContent { get; set; }

Property Value

bool

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

cs-api-definition
public double Top { get; set; }

Property Value

double

WindowState

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

Declaration

cs-api-definition
public WindowState WindowState { get; set; }

Property Value

WindowState

Methods

BringToFront()

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

Declaration

cs-api-definition
public void BringToFront()

Remarks

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

ChangeVisualState()

Updates the visual state of the control.

Declaration

cs-api-definition
protected void ChangeVisualState()

ChangeVisualState(bool)

Updates the visual state of the control.

Declaration

cs-api-definition
protected virtual void ChangeVisualState(bool useTransitions)

Parameters

useTransitions

bool

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

cs-api-definition
protected virtual bool CheckCanClose()

Returns

bool

True if the window can be changed; false otherwise.

Close()

Manually closes WindowBase.

Declaration

cs-api-definition
public void Close()

Remarks

Raises Closing and Closed events consequently.

CloseWithoutEventsAndAnimations()

Closes the Window instantly and the closing cannot be interrupted.

Declaration

cs-api-definition
protected void CloseWithoutEventsAndAnimations()

GetApplicationSize()

Gets the application size depending on the platform.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
protected Size GetApplicationSize()

Returns

Size

GetNormalSizeAndPosition()

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

Declaration

cs-api-definition
public Rect GetNormalSizeAndPosition()

Returns

Rect

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

GetWindowOwner()

Gets the owner of the WindowBase.

Declaration

cs-api-definition
protected virtual ContentControl GetWindowOwner()

Returns

ContentControl

GetWindowOwnerHandle()

Gets the owner handle of the WindowBase.

Declaration

cs-api-definition
protected virtual nint GetWindowOwnerHandle()

Returns

nint

GetWindowStartupLocation()

Gets the startup location of the WindowBase.

Declaration

cs-api-definition
protected virtual WindowStartupLocation GetWindowStartupLocation()

Returns

WindowStartupLocation

GetZIndex()

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

Declaration

cs-api-definition
public virtual int GetZIndex()

Returns

int

OnActivated(EventArgs)

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

Declaration

cs-api-definition
protected virtual void OnActivated(EventArgs e)

Parameters

e

EventArgs

The EventArgs instance containing the event data.

OnCloseAnimationFinished()

Closes the host immediately without any animations and events.

Declaration

cs-api-definition
protected virtual void OnCloseAnimationFinished()

OnClosed()

Closes the host immediately without any animations and events.

Declaration

cs-api-definition
protected virtual void OnClosed()

OnClosing()

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

Declaration

cs-api-definition
protected virtual bool OnClosing()

Returns

bool

OnCreateAutomationPeer()

Create the automation peer for this class.

Declaration

cs-api-definition
protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

OnDeactivated(EventArgs)

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

Declaration

cs-api-definition
protected virtual void OnDeactivated(EventArgs e)

Parameters

e

EventArgs

The EventArgs instance containing the event data.

OnDragDelta(Point, Rect, Rect, bool)

Handles the delta of the drag operation.

Declaration

cs-api-definition
protected virtual Rect OnDragDelta(Point globalMousePosition, Rect initialRect, Rect destinationRect, bool isResize)

Parameters

globalMousePosition

Point

initialRect

Rect

destinationRect

Rect

isResize

bool

Returns

Rect

OnDragEnd(Point, bool, bool)

Handles the end of the drag operation.

Declaration

cs-api-definition
protected virtual void OnDragEnd(Point globalMousePosition, bool isCancel, bool isResize)

Parameters

globalMousePosition

Point

isCancel

bool

isResize

bool

OnDragStart(Point, bool)

Handles the start of the drag operation.

Declaration

cs-api-definition
protected virtual void OnDragStart(Point globalMousePosition, bool isResize)

Parameters

globalMousePosition

Point

isResize

bool

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

cs-api-definition
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)

Parameters

e

KeyboardFocusChangedEventArgs

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

OnHostCreated(HostWindowCreatedEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnHostCreated(HostWindowCreatedEventArgs args)

Parameters

args

HostWindowCreatedEventArgs

The HostWindowCreatedEventArgs instance containing the event data.

OnLayoutChangeEnded()

Ends the layout changing scope and raises the event.

Declaration

cs-api-definition
protected void OnLayoutChangeEnded()

OnLayoutChangeEnded(EventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnLayoutChangeEnded(EventArgs args)

Parameters

args

EventArgs

The EventArgs instance containing the event data.

OnLayoutChangeStarted()

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

Declaration

cs-api-definition
protected void OnLayoutChangeStarted()

OnLayoutChangeStarted(EventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnLayoutChangeStarted(EventArgs args)

Parameters

args

EventArgs

The EventArgs instance containing the event data.

OnLocationChanged(EventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnLocationChanged(EventArgs args)

Parameters

args

EventArgs

The RoutedEventArgs instance containing the event data.

OnRightMouseButtonUp()

Closes the host immediately without any animations and events.

Declaration

cs-api-definition
protected virtual void OnRightMouseButtonUp()

OnRootVisualSizeChanged()

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

Declaration

cs-api-definition
protected virtual void OnRootVisualSizeChanged()

OnShowAnimationFinished()

Closes the host immediately without any animations and events.

Declaration

cs-api-definition
protected virtual void OnShowAnimationFinished()

OnWindowStateChanged(EventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnWindowStateChanged(EventArgs args)

Parameters

args

EventArgs

The RoutedEventArgs instance containing the event data.

ShouldActivate()

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

Declaration

cs-api-definition
protected virtual bool ShouldActivate()

Returns

bool

ShouldActivateOnShow()

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

Declaration

cs-api-definition
protected virtual bool ShouldActivateOnShow()

Returns

bool

ShouldFocusOnActivate()

Indicates whether the Window should focus when it is activated.

Declaration

cs-api-definition
protected virtual bool ShouldFocusOnActivate()

Returns

bool

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

cs-api-definition
protected virtual bool ShouldShowInTaskSwitcher()

Returns

bool

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

cs-api-definition
protected virtual bool ShouldSystemMenuOnRightClick()

Returns

bool

ShowWindow(bool)

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

Declaration

cs-api-definition
protected virtual void ShowWindow(bool isModal)

Parameters

isModal

bool

Whether the window is modal or not.

Events

Activated

Occurs when the Window is activated.

Declaration

cs-api-definition
public event EventHandler Activated

Event Value

EventHandler

Deactivated

Occurs when the Window is deactivated.

Declaration

cs-api-definition
public event EventHandler Deactivated

Event Value

EventHandler

LayoutChangeEnded

Occurs when a layout change is ended.

Declaration

cs-api-definition
public event EventHandler LayoutChangeEnded

Event Value

EventHandler

Implements INotifyLayoutChange.LayoutChangeEnded

LayoutChangeStarted

Occurs when a layout change is started.

Declaration

cs-api-definition
public event EventHandler LayoutChangeStarted

Event Value

EventHandler

Implements INotifyLayoutChange.LayoutChangeStarted

LocationChanged

Occurs when the value of a Left or Top changes.

Declaration

cs-api-definition
[SRCategory("Behavior")]
public event EventHandler LocationChanged

Event Value

EventHandler

WindowStateChanged

Occurs when the value of a WindowState changes.

Declaration

cs-api-definition
[SRCategory("Behavior")]
public event EventHandler WindowStateChanged

Event Value

EventHandler

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