Class VisualUtils
Class that stores static methods that operate on visuals.
Inheritance
Namespace: Syncfusion.Windows.Shared
Assembly: Syncfusion.Shared.WPF.dll
Syntax
public sealed class VisualUtils : Object
Fields
RootPopupType
This member contains framework internal PopupRoot type.
Declaration
public static Type RootPopupType
Field Value
Type |
---|
System.Type |
Methods
EnumChildrenOfType(Visual, Type)
Enumerates all visuals in the target visual tree that are instances of the specified type.
Declaration
public static IEnumerable<Visual> EnumChildrenOfType(Visual rootelement, Type typeChild)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | rootelement | Target element to search in. |
System.Type | typeChild | Type of the children to find. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Windows.Media.Visual> | Enumerator with children of the specified type. |
Remarks
Enumeration of children that is done through the iterate
EnumLogicalChildrenOfType(DependencyObject, Type)
Enumerates all instances in the target element logical tree that are instances of the specified type.
Declaration
public static IEnumerable<DependencyObject> EnumLogicalChildrenOfType(DependencyObject rootelement, Type typeChild)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | rootelement | Target element to search in. |
System.Type | typeChild | Type of the children to find. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Windows.DependencyObject> | Enumerator with children of the specified type. |
Remarks
Enumeration of children that is done through the iterate
FindAncestor(Visual, Type)
Looks for the visual ancestor of the specified type.
Declaration
public static Visual FindAncestor(Visual startingFrom, Type typeAncestor)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | startingFrom | System.Windows.Media.Visual the search is started from. |
System.Type | typeAncestor | Desired type of the ancestor. |
Returns
Type | Description |
---|---|
System.Windows.Media.Visual | System.Windows.Media.Visual of the specified type, or null if no ancestors of the specified type were found. |
FindDescendant(Visual, String)
Looks for the visual Descendant of the specified type.
Declaration
public static Visual FindDescendant(Visual startingFrom, string typeNameDescendant)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | startingFrom | System.Windows.Media.Visual the search is started from. |
System.String | typeNameDescendant | Name ofthe desired type of the Descendant element. |
Returns
Type | Description |
---|---|
System.Windows.Media.Visual | System.Windows.Media.Visual of the specified type, or null if no Descendants of the specified type were found. |
FindDescendant(Visual, Type)
Looks for the visual Descendant of the specified type.
Declaration
public static Visual FindDescendant(Visual startingFrom, Type typeDescendant)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | startingFrom | System.Windows.Media.Visual the search is started from. |
System.Type | typeDescendant | Desired type of the Descendant element. |
Returns
Type | Description |
---|---|
System.Windows.Media.Visual | System.Windows.Media.Visual of the specified type, or null if no Descendants of the specified type were found. |
FindLogicalAncestor(Visual, Type)
Finds the logical ancestor.
Declaration
public static Visual FindLogicalAncestor(Visual startingFrom, Type typeAncestor)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | startingFrom | The starting from. |
System.Type | typeAncestor | The type ancestor. |
Returns
Type |
---|
System.Windows.Media.Visual |
FindRootVisual(Visual)
Looks for the root visual starting from the specified one.
Declaration
public static Visual FindRootVisual(Visual startingFrom)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | startingFrom | Specified System.Windows.Media.Visual element from which search for root visual starts. |
Returns
Type | Description |
---|---|
System.Windows.Media.Visual | System.Windows.Media.Visual that represents root visual. |
FindSomeParent(FrameworkElement, Type)
Looks for the logical ancestor of the specified type.
Declaration
public static FrameworkElement FindSomeParent(FrameworkElement rootelement, Type typeParent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | rootelement | System.Windows.FrameworkElement the search is started from. |
System.Type | typeParent | Desired type of the parent. |
Returns
Type | Description |
---|---|
System.Windows.FrameworkElement | Object of the specified type, or null if no ancestors of the specified type were found. |
FindVisualParent<T>(DependencyObject)
Finds a parent of a given item on the visual tree.
Declaration
public static T FindVisualParent<T>(DependencyObject child)
where T : DependencyObject
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | child | A direct or indirect child of the queried item. |
Returns
Type | Description |
---|---|
T | The first parent item that matches the submitted type parameter. If not matching item can be found, a null reference is being returned. |
Type Parameters
Name | Description |
---|---|
T | The type of the queried item. |
GetItemsControlFromChildren(FrameworkElement)
Finds parent items control for given element.
Declaration
public static ItemsControl GetItemsControlFromChildren(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element |
Returns
Type |
---|
System.Windows.Controls.ItemsControl |
GetItemsPanel(ItemsControl, Type)
Gets the items panel of corresponding items control.
Declaration
public static Panel GetItemsPanel(ItemsControl owner, Type panelType)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.ItemsControl | owner | The owner. |
System.Type | panelType | Type of the panel. |
Returns
Type |
---|
System.Windows.Controls.Panel |
GetPageFromChildren(FrameworkElement)
Finds parent Page object through given element.
Declaration
public static Page GetPageFromChildren(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element | The element. |
Returns
Type |
---|
System.Windows.Controls.Page |
GetPointRelativeTo(UIElement, UIElement)
Gets the point relative to.
Declaration
public static Point GetPointRelativeTo(UIElement visual, UIElement relativeTo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | visual | The visual. |
System.Windows.UIElement | relativeTo | The relative to. |
Returns
Type | Description |
---|---|
System.Windows.Point | Return point value. |
GetWindowFromChildren(FrameworkElement)
Finds parent Window object through given element.
Declaration
public static Window GetWindowFromChildren(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element |
Returns
Type |
---|
System.Windows.Window |
HasChildOfType(Visual, Type)
This method gets a value indicating whether the current element contains a child of specified type.
Declaration
public static bool HasChildOfType(Visual rootelEment, Type searchType)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.Visual | rootelEment | The root element. |
System.Type | searchType | Specified type |
Returns
Type | Description |
---|---|
System.Boolean | Result of searching. |
InvalidateParentMeasure(FrameworkElement)
Invalidates measurement of the element parent.
Declaration
public static void InvalidateParentMeasure(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element | Element of parent. |
IsDescendant(DependencyObject, DependencyObject)
Indicates whether node element contains in some element.
Declaration
public static bool IsDescendant(DependencyObject reference, DependencyObject node)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | reference | Root element. |
System.Windows.DependencyObject | node | Node element |
Returns
Type | Description |
---|---|
System.Boolean | Value indicates when node element contains in some element. |
PointToScreen(UIElement, Point)
Points to screen.
Declaration
public static Point PointToScreen(UIElement visual, Point point)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | visual | The visual value. |
System.Windows.Point | point | The point value. |
Returns
Type | Description |
---|---|
System.Windows.Point | Return the point value |
SetDependencyPropertyUsedByAnimation(UIElement, DependencyProperty, Double)
This method stops animation and set new value on given dependency property of target element.
Declaration
public static void SetDependencyPropertyUsedByAnimation(UIElement targetElement, DependencyProperty dependencyProperty, double value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | targetElement | Target element. |
System.Windows.DependencyProperty | dependencyProperty | Given dependency property. |
System.Double | value | New value to set. |
SetDependencyPropretyUsedByAnimation(UIElement, DependencyProperty, Double)
This method stops animation and set new value on given dependency property of target element.
Declaration
public static void SetDependencyPropretyUsedByAnimation(UIElement targetElement, DependencyProperty dependencyProperty, double value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | targetElement | Target element. |
System.Windows.DependencyProperty | dependencyProperty | Given dependency property. |
System.Double | value | New value to set. |