projects/wms-framework/src/lib/media/VisualTreeHelper.ts
VisualTreeHelper class
Methods |
|
Static FindElementsInHostCoordinates | ||||||
FindElementsInHostCoordinates(point, element)
|
||||||
Find elements in host coordinates
Parameters :
Returns :
Iterable<UIElement>
{Iterable |
Static GetChild | |||||||||
GetChild(obj: DependencyObject, idx: number)
|
|||||||||
Gets the child element at the index position
Parameters :
Returns :
DependencyObject
{DependencyObject} |
Static GetChildrenCount | ||||||
GetChildrenCount(obj: DependencyObject)
|
||||||
Method o know the amount of children the parent has
Parameters :
Returns :
number
{number} |
Static GetParent | ||||||
GetParent(obj: DependencyObject)
|
||||||
Parameters :
Returns :
UIElement
|
import { Control } from '../basecomponentmodel/Control';
import { DependencyObject } from '../basecomponentmodel/DependencyObject';
import { FrameworkElement } from '../basecomponentmodel/FrameworkElement';
import { UIElement } from '../basecomponentmodel/UIElement';
import { Debugger } from '../diagnostics/Debugger';
/**
* VisualTreeHelper class
*
* @export
* @class VisualTreeHelper
* @wType System.Windows.Media.VisualTreeHelper
*/
export class VisualTreeHelper {
/**
* Gets the child element at the index position
*
* @static
* @param {DependencyObject} obj
* @param {number} idx
* @return {*} {DependencyObject}
* @memberof VisualTreeHelper
*/
public static GetChild(obj: DependencyObject, idx: number): DependencyObject {
if (
obj instanceof Control &&
obj.templateModel &&
obj.templateModel.GetChild
) {
return obj.templateModel.GetChild(idx);
} else if (obj instanceof FrameworkElement) {
return obj.GetChild(idx);
}
return null;
}
/**
* Method o know the amount of children the parent has
*
* @static
* @param {DependencyObject} obj
* @return {*} {number}
* @memberof VisualTreeHelper
*/
public static GetChildrenCount(obj: DependencyObject): number {
if (
obj instanceof Control &&
obj.templateModel &&
obj.templateModel.GetChildrenCount
) {
return obj.templateModel.GetChildrenCount();
} else {
return obj.GetChildrenCount();
}
}
public static GetParent(obj: DependencyObject): UIElement {
if (obj instanceof FrameworkElement) {
return obj.Parent;
}
return null;
}
/**
* Find elements in host coordinates
*
* @static
* @param {*} point
* @param {*} element
* @return {*} {Iterable<UIElement>}
* @memberof VisualTreeHelper
* @wNoMap
*/
public static FindElementsInHostCoordinates(
point,
element
): Iterable<UIElement> {
Debugger.Throw('Not implemented');
return null;
}
}