ClassWindowBase
Base class for creating a custom Window.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.Navigation.dll
Syntax:
public abstract class WindowBase : HeaderedContentControl, INotifyLayoutChange, IDragAware
Inheritance: objectWindowBase
Derived Classes:
Implements:
Constructors
WindowBase()
Initializes a new instance of the WindowBase class.
Declaration
protected WindowBase()
Fields
CanCloseProperty
Identifies the
Declaration
public static readonly DependencyProperty CanCloseProperty
Field Value
DependencyProperty
CanMoveProperty
Identifies the
Declaration
public static readonly DependencyProperty CanMoveProperty
Field Value
DependencyProperty
CaptionHeightProperty
Identifies the CaptionHeight dependency property.
Declaration
public static readonly DependencyProperty CaptionHeightProperty
Field Value
DependencyProperty
CornerRadiusProperty
Identifies the
Declaration
public static readonly DependencyProperty CornerRadiusProperty
Field Value
DependencyProperty
HideMaximizeButtonProperty
Identifies the HideMaximizeButton dependency property.
Declaration
public static readonly DependencyProperty HideMaximizeButtonProperty
Field Value
DependencyProperty
HideMinimizeButtonProperty
Identifies the HideMinimizeButton dependency property.
Declaration
public static readonly DependencyProperty HideMinimizeButtonProperty
Field Value
DependencyProperty
IsActiveWindowProperty
Identifies the
Declaration
public static readonly DependencyProperty IsActiveWindowProperty
Field Value
DependencyProperty
IsDraggingProperty
Identifies the
Declaration
public static readonly DependencyProperty IsDraggingProperty
Field Value
DependencyProperty
IsInActiveStateProperty
Identifies the
Declaration
public static readonly DependencyProperty IsInActiveStateProperty
Field Value
DependencyProperty
IsModalProperty
Identifies the
Declaration
public static readonly DependencyProperty IsModalProperty
Field Value
DependencyProperty
IsOpenProperty
Identifies the
Declaration
public static readonly DependencyProperty IsOpenProperty
Field Value
DependencyProperty
IsResizingProperty
Identifies the
Declaration
public static readonly DependencyProperty IsResizingProperty
Field Value
DependencyProperty
IsTopmostProperty
Identifies the IsTopmost dependency property.
Declaration
public static readonly DependencyProperty IsTopmostProperty
Field Value
DependencyProperty
LeftProperty
Identifies the
Declaration
public static readonly DependencyProperty LeftProperty
Field Value
DependencyProperty
ResizeBorderProperty
Identifies the ResizeBorder dependency property.
Declaration
public static readonly DependencyProperty ResizeBorderProperty
Field Value
DependencyProperty
ResizeModeProperty
Identifies the
Declaration
public static readonly DependencyProperty ResizeModeProperty
Field Value
DependencyProperty
SizeToContentProperty
Identifies the
Declaration
public static readonly DependencyProperty SizeToContentProperty
Field Value
DependencyProperty
TopProperty
Identifies the
Declaration
public static readonly DependencyProperty TopProperty
Field Value
DependencyProperty
WindowStateProperty
Identifies the
Declaration
public static readonly DependencyProperty WindowStateProperty
Field Value
DependencyProperty
Properties
CanClose
Gets or sets whether WindowBase can be closed. This is a dependency property.
Declaration
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.
CanMove
Gets or sets whether WindowBase can be dragged. This is a dependency property.
Declaration
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.
CaptionHeight
The extent of the top of the window to treat as the caption.
CornerRadius
Gets or sets the CornerRadius property.
Declaration
public CornerRadius CornerRadius { get; set; }
Property Value
CornerRadius
HideMaximizeButton
Gets or sets the visibility of the Maximize button.
HideMinimizeButton
Gets or sets the visibility of the Minimize button.
IsActiveWindow
Gets a value indicating whether this instance is active. This is a dependency property.
Declaration
public bool IsActiveWindow { get; }
Property Value
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
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.
IsLayoutChanging
Gets a value indicating whether this instance is layout changing.
Declaration
public bool IsLayoutChanging { get; }
Property Value
True if this instance is layout changing; otherwise, false.
Implements
IsModal
Gets a value that represents whether the WindowBase is modal. This is a dependency property.
IsOpen
Gets a value that represents whether the WindowBase is open. This is a dependency property.
IsResizing
Gets a value indicating whether this instance is resizing. This is a dependency property.
Declaration
public bool IsResizing { get; protected set; }
Property Value
True if this instance is resizing;false otherwise.
IsTopmost
Gets or sets whether the WindowBase is on top.
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.
Owner
Gets or sets the Owner of the WindowBase.
Declaration
public ContentControl Owner { get; set; }
Property Value
ContentControl
ResizeBorder
Get the bounds of the resize grips on the Window.
Declaration
public Thickness ResizeBorder { get; set; }
Property Value
Thickness
ResizeMode
Gets or sets a ResizeMode value for the WindowBase. This is a dependency property.
Declaration
public ResizeMode ResizeMode { get; set; }
Property Value
ResizeMode
SizeToContent
The value of this property is ignored if the Width and Height properties are set.
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.
WindowState
Gets or sets a WindowBase value for the WindowBase. This is a dependency property.
Declaration
public WindowState WindowState { get; set; }
Property Value
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(bool)
Updates the visual state of the control.
Declaration
protected virtual void ChangeVisualState(bool useTransitions)
Parameters
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
True if the window can be changed; false otherwise.
Close()
Manually closes WindowBase.
Declaration
public void Close()
Remarks
Raises
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
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
protected Size GetApplicationSize()
Returns
Size
GetNormalSizeAndPosition()
Gets the size and position of the WindowBase in its normal state.
Declaration
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
protected virtual ContentControl GetWindowOwner()
Returns
ContentControl
GetWindowOwnerHandle()
Gets the owner handle of the WindowBase.
GetWindowStartupLocation()
Gets the startup location of the WindowBase.
Declaration
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.
OnActivated(EventArgs)
Raises the event. This method is called when the window is activated.
OnCloseAnimationFinished()
Closes the host immediately without any animations and events.
Declaration
protected virtual void OnCloseAnimationFinished()
OnClosed()
Closes the host immediately without any animations and events.
Declaration
protected virtual void OnClosed()
OnClosing()
Checks whether the window can be closed and raises the Closing event.
OnCreateAutomationPeer()
Create the automation peer for this class.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
AutomationPeer
OnDeactivated(EventArgs)
Raises the event. This method is called when the window is deactivated.
OnDragDelta(Point, Rect, Rect, bool)
Handles the delta of the drag operation.
Declaration
protected virtual Rect OnDragDelta(Point globalMousePosition, Rect initialRect, Rect destinationRect, bool isResize)
Parameters
globalMousePosition
Point
initialRect
Rect
destinationRect
Rect
isResize
Returns
Rect
OnDragEnd(Point, bool, bool)
Handles the end of the drag operation.
OnDragStart(Point, bool)
Handles the start of the drag operation.
Declaration
protected virtual void OnDragStart(Point globalMousePosition, bool isResize)
Parameters
globalMousePosition
Point
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
e
KeyboardFocusChangedEventArgs
The System.Windows.Input.KeyboardFocusChangedEventArgs that contains the event data.
OnHostCreated(HostWindowCreatedEventArgs)
Raises the event.
Declaration
protected virtual void OnHostCreated(HostWindowCreatedEventArgs args)
Parameters
args
The HostWindowCreatedEventArgs instance containing the event data.
OnLayoutChangeEnded()
Ends the layout changing scope and raises the event.
Declaration
protected void OnLayoutChangeEnded()
OnLayoutChangeEnded(EventArgs)
Raises the event.
OnLayoutChangeStarted()
Begins the layout changing scope and raises the event if it is not already active.
Declaration
protected void OnLayoutChangeStarted()
OnLayoutChangeStarted(EventArgs)
Raises the event.
OnLocationChanged(EventArgs)
Raises the event.
Declaration
protected virtual void OnLocationChanged(EventArgs args)
Parameters
args
The RoutedEventArgs instance containing the event data.
OnRightMouseButtonUp()
Closes the host immediately without any animations and events.
Declaration
protected virtual void OnRightMouseButtonUp()
OnRootVisualSizeChanged()
Updates the position helper and checks the restricted area and updates the rect of the window.
Declaration
protected virtual void OnRootVisualSizeChanged()
OnShowAnimationFinished()
Closes the host immediately without any animations and events.
Declaration
protected virtual void OnShowAnimationFinished()
OnWindowStateChanged(EventArgs)
Raises the event.
Declaration
protected virtual void OnWindowStateChanged(EventArgs args)
Parameters
args
The RoutedEventArgs instance containing the event data.
ShouldActivate()
Indicates whether the Window should be activated when the focus goes to it.
ShouldActivateOnShow()
Indicates whether the Window should be activated when it is shown.
ShouldFocusOnActivate()
Indicates whether the Window should focus when it is activated.
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).
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.
ShowWindow(bool)
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
isModal
Whether the window is modal or not.
Events
Activated
Occurs when the Window is activated.
Deactivated
Occurs when the Window is deactivated.
LayoutChangeEnded
Occurs when a layout change is ended.
Declaration
public event EventHandler LayoutChangeEnded
Event Value
Implements
LayoutChangeStarted
Occurs when a layout change is started.
Declaration
public event EventHandler LayoutChangeStarted
Event Value
Implements
LocationChanged
Occurs when the value of a Left or Top changes.
Declaration
[SRCategory("Behavior")]
public event EventHandler LocationChanged
Event Value
WindowStateChanged
Occurs when the value of a WindowState changes.
Declaration
[SRCategory("Behavior")]
public event EventHandler WindowStateChanged
Event Value
Remarks
The event is raised whenever the