// -------------------------------------------------------------------------------------------------------------------- // <copyright file="VisualExtensions.cs" company="Catel development team"> // Copyright (c) 2008 - 2011 Catel development team. All rights reserved. // </copyright> // <summary> // Extensions for <see cref="System.Windows.Media.Visual" />. // </summary> // -------------------------------------------------------------------------------------------------------------------- using System.Windows; using System.Windows.Media; namespace Catel.Windows.Media { /// <summary> /// Extensions for <see cref="System.Windows.Media.Visual"/>. /// </summary> public static class VisualExtensions { #region Methods /// <summary> /// Get the parent window for this visual object or null when not exists. /// </summary> /// <param name="visualObject">Reference to visual object.</param> /// <returns>Reference to partent window or null when not exists.</returns> public static Window GetParentWindow(this Visual visualObject) { return visualObject.GetAncestorObject<Window>(); } #endregion } }
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Math Primers for Programmers