ClassFrameworkElement
The base FrameworkElement that represents any visual element in the Silverlight application.
Definition
Namespace:ArtOfTest.WebAii.Silverlight
Assembly:ArtOfTest.WebAii.dll
Syntax:
[DataContract]
public class FrameworkElement : AutomationObject<FrameworkElement>, IAutomationPeer, IPeerConverter, IFrameworkElement, ITargetElement
Inheritance: objectAutomationObject<FrameworkElement>FrameworkElement
Derived Classes:
Implements:
Inherited Members
Constructors
FrameworkElement()
Create a new FrameworkElement.
Declaration
public FrameworkElement()
Fields
ActualHeightProperty
Defines how to get the ActualHeight property of this element.
Declaration
public static AutomationProperty ActualHeightProperty
Field Value
ActualWidthProperty
Defines how to get the ActualWidth property of this element.
Declaration
public static AutomationProperty ActualWidthProperty
Field Value
ClipProperty
Defines how to get the Clip property of this element.
Declaration
public static AutomationProperty ClipProperty
Field Value
DataContextProperty
Defines how to get the DataContext property of this element.
Declaration
public static AutomationProperty DataContextProperty
Field Value
DesiredSizeProperty
Defines how to get the DesiredSize property of this element.
Declaration
public static AutomationProperty DesiredSizeProperty
Field Value
HeightProperty
Defines how to get the Height property of this element.
Declaration
public static AutomationProperty HeightProperty
Field Value
HorizontalAlignmentProperty
Defines how to get the HorizontalAlignment property of this element.
Declaration
public static AutomationProperty HorizontalAlignmentProperty
Field Value
IsHitTestVisibleProperty
Defines how to get the IsHitTestVisible property of this element.
Declaration
public static AutomationProperty IsHitTestVisibleProperty
Field Value
MarginProperty
Defines how to get the Margin property of this element.
Declaration
public static AutomationProperty MarginProperty
Field Value
MaxHeightProperty
Defines how to get the MaxHeight property of this element.
Declaration
public static AutomationProperty MaxHeightProperty
Field Value
MaxWidthProperty
Defines how to get the MaxWidth property of this element.
Declaration
public static AutomationProperty MaxWidthProperty
Field Value
MinHeightProperty
Defines how to get the MinHeight property of this element.
Declaration
public static AutomationProperty MinHeightProperty
Field Value
MinWidthProperty
Defines how to get the MinWidth property of this element.
Declaration
public static AutomationProperty MinWidthProperty
Field Value
NameProperty
Defines how to get the Name property of this element.
Declaration
public static AutomationProperty NameProperty
Field Value
OpacityMaskProperty
Defines how to get the OpacityMask property of this element.
Declaration
public static AutomationProperty OpacityMaskProperty
Field Value
OpacityProperty
Defines how to get the Opacity property of this element.
Declaration
public static AutomationProperty OpacityProperty
Field Value
RenderSizeProperty
Defines how to get the RenderSize property of this element.
Declaration
public static AutomationProperty RenderSizeProperty
Field Value
RenderTransformOriginProperty
Defines how to get the RenderTransformOrigin property of this element.
Declaration
public static AutomationProperty RenderTransformOriginProperty
Field Value
RenderTransformProperty
Defines how to get the RenderTransform property of this element.
Declaration
public static AutomationProperty RenderTransformProperty
Field Value
TagProperty
Defines how to get the Tag property of this element.
Declaration
public static AutomationProperty TagProperty
Field Value
VerticalAlignmentProperty
Defines how to get the VerticalAlignment property of this element.
Declaration
public static AutomationProperty VerticalAlignmentProperty
Field Value
VisibilityProperty
Defines how to get the Visibility property of this element.
Declaration
public static AutomationProperty VisibilityProperty
Field Value
WidthProperty
Defines how to get the Width property of this element.
Declaration
public static AutomationProperty WidthProperty
Field Value
Properties
AbsoluteSiblingTagIndex
Get the sibling tag index of this FrameworkElement.
Declaration
public int AbsoluteSiblingTagIndex { get; }
Property Value
Implements
AbsoluteTagIndex
Get the absolute index of this Xaml tag in the Visual Tree.
ActualHeight
Gets the value of the ActualHeight of this element.
ActualWidth
Gets the value of the ActualWidth of this element.
Application
Get the Application object that owns this element.
Declaration
[Browsable(false)]
public IApplication Application { get; }
Property Value
AutomationId
Gets the AutomationId set on this element if any.
Children
Gets the visual children of this element.
Declaration
public IList<FrameworkElement> Children { get; }
Property Value
Clip
Gets / Sets the value of the Clip of this element.
ComputedVisibility
Declaration
public virtual Visibility ComputedVisibility { get; }
Property Value
Implements
Depth
Get the depth of this element in the Visual Tree.
DesiredSize
Gets the value of the DesiredSize of this element.
EnableValidateMouseLocation
Enables or disables the validation of mouse click locations before performing mouse actions
Declaration
public bool EnableValidateMouseLocation { get; set; }
Property Value
Find
Get the Find object used to search the visual children of this element.
Declaration
[Browsable(false)]
public VisualFind Find { get; }
Property Value
Implements
Height
Gets / Sets the value of the Height of this element.
HorizontalAlignment
Gets / Sets the value of the HorizontalAlignment of this element.
Declaration
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Host
Returns the AutomationHost for this object.
Declaration
public IAutomationHost Host { get; }
Property Value
Implements
IsHitTestVisible
Gets / Sets the value of the IsHitTestVisible of this element.
IsTestRegion
Gets whether or not this element is contained in a test region.
Mappings
Gets a mappings collection that stores customizable control specific mapping knowledge that can be later customized.
Declaration
public virtual MappingsCollection Mappings { get; }
Property Value
Margin
Gets / Sets the value of the Margin of this element.
MaxHeight
Gets / Sets the value of the MaxHeight of this element.
MaxWidth
Gets / Sets the value of the MaxWidth of this element.
MinHeight
Gets / Sets the value of the MinHeight of this element.
MinWidth
Gets /Sets the value of the MinWidth of this element.
Name
Gets the value of the Name of this element.
Opacity
Gets / Sets the value of the Opacity of this element.
OpacityMask
Gets / Sets the value of the OpacityMask of this element.
ParsedElement
Get the parsed element under this object.
Declaration
public ParsedElement ParsedElement { get; }
Property Value
Implements
RenderSize
Gets the value of the RenderSize of this element.
RenderTransform
Gets / Sets the value of the RenderTransform of this element.
Declaration
public Transform RenderTransform { get; set; }
Property Value
RenderTransformOrigin
Gets / Sets the value of the RenderTransformOrigin of this element.
TagNameIndex
Gets the tag name index of the xaml tag name in the visual tree.
TechnologyType
Get the technology type of this element.
Declaration
public virtual TechnologyType TechnologyType { get; }
Property Value
Implements
Text
Gets the element text, the first text block text by default.
TextBlockContent
Gets the text from all the inner TextBlock elements.
Declaration
public string TextBlockContent { get; }
Property Value
Implements
TextLiteralContent
Gets the literal text content of this framework element if any.
Declaration
public string TextLiteralContent { get; }
Property Value
Implements
ToolTipText
The text of the tooltip specified for this element
Declaration
public virtual string ToolTipText { get; }
Property Value
Implements
Uid
Unique identifier for this control in its application. For internal use.
User
Gets the UI interaction object that allows you to interact with this framework element directly using real mouse and keyboard interactions
Declaration
[Browsable(false)]
public virtual UserInteraction User { get; }
Property Value
Implements
VerticalAlignment
Gets / Sets the value of the VerticalAlignment of this element.
Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Visibility
Gets / Sets the value of the Visibility of this element.
Wait
Gets a VisualWait object to be used on waiting for Visual elemnets in the VisualTree.
Declaration
[Browsable(false)]
public VisualWait Wait { get; }
Property Value
Implements
Width
Gets / Sets the value of the Width of this element.
XamlTag
Get the xaml tag name of this FrameworkElement. This is used for hierarchy matching and traversal.
XamlTagBase
Gets the lowest control type that the framework recognizes
Methods
AddChildNode(ITargetElement)
Add a child node to this framework element.
Declaration
public void AddChildNode(ITargetElement child)
Parameters
child
Implements
AnySibling(string)
Return any sibling of this control of the specified type. This method searches the previous siblings first, then the next sibilings.
Declaration
public FrameworkElement AnySibling(string controlType)
Parameters
controlType
The desired control type to match (i.e. 'Button', 'Calendar' ...etc)
Returns
The matching sibling else null.
AnySibling<T>()
Return any sibling of this control of the specified type.
Declaration
public T AnySibling<T>() where T : FrameworkElement
Returns
T
As<T>()
Return this framework element as a strongly-typed control.
Declaration
public T As<T>() where T : FrameworkElement
Returns
T
The desired control instance.
AssignReference(AutomationReference)
Assign the automation reference to this element.
Declaration
public override void AssignReference(AutomationReference reference)
Parameters
reference
The automation reference to assign.
Overrides
Implements
Capture()
Capture the image of this element.
CaptureImage()
Captures the image of current element with scaling and OS information.
Declaration
public ElementImage CaptureImage()
Returns
ElementsImage object of current element.
Implements
CastAs<T>()
Returns this framework element as a strongly-typed control without enforcing tag name to match the type. This functions gives you free casting abilities between types.
Declaration
public T CastAs<T>() where T : IFrameworkElement
Returns
T
The control type
Implements
EnsureClickable()
Performs best-effort operations to ensure that this element is user-visible and avialable for simulated user actions.
Declaration
public void EnsureClickable()
Equals(object)
Determines whether this FrameworkElement is equal to another, by comparing their AutomationReferences
FromRealObject(object)
Used internally to translate object across application boundaries
Declaration
public override void FromRealObject(object o)
Parameters
o
Overrides
GetAttachedProperty<T>(string, string)
Get value of attached property.
GetAutomationProperty(string)
Declaration
public AutomationProperty GetAutomationProperty(string name)
Parameters
name
Returns
Implements
GetChildTagIndex(FrameworkElement)
Given a child FrameworkElement of this element, return this child's tag index relative to this element. If the child has the same tag name as this element, it will not be counted.
Declaration
public int GetChildTagIndex(FrameworkElement child)
Parameters
child
The child to find the index of.
Returns
The child tag index else -1
GetChildren()
Get the children of this framework element.
Declaration
public ITargetElement[] GetChildren()
Returns
The list of children
Implements
GetControlTypeFromInterface(Type)
Get the loaded Xaml control type by given interface control type. Useful for sharing common Xaml (SL/Wpf) controls.
GetHashCode()
Calculates and returns the hashcode for this element.
GetHostParent()
Not implemented for Silverlight elements. Returns null.
Declaration
public ITargetElement GetHostParent()
Returns
Implements
GetIdentifier(out string, out string)
Gets whether this framework element has an automationid set on it or name. If it does, it will return which one was found and its value. If both are found, AutomationId will be returned first.
GetIntRectangle()
Gets the bounding rectangle of this element within the Silverlight app with integral coordinates
Declaration
public Rectangle GetIntRectangle()
Returns
The rectangle of this element
GetKnownControlTypes(TechnologyType)
Return all the known control types.
Declaration
public static List<string> GetKnownControlTypes(TechnologyType techType)
Parameters
techType
Returns
GetNextSibling()
Get the next sibling of this FrameworkElement.
Declaration
public FrameworkElement GetNextSibling()
Returns
The next sibling else null.
GetParent()
Get the Parent of this element.
Declaration
public ITargetElement GetParent()
Returns
Return the parent object.
Implements
GetPrevSibling()
Get the previous sibling.
GetProperties()
Reads and returns the specified property from this element.
Declaration
public Dictionary<string, string> GetProperties()
Returns
The value of the specified property as a string.
GetProperty<T>(string)
Gets the property value by given name. Will be useful for common translators supporting different technologies (SL/Wpf).
Declaration
public T GetProperty<T>(string name)
Parameters
name
The property name.
Returns
T
The property return type.
Implements
GetRealType()
Gets the real object type. This property returns string.empty on FrameworkElement and all subclasses that inherit from it.
GetRectangle()
Get the bounding rectangle of this element within this Silverlight App.
Declaration
public RectangleF GetRectangle()
Returns
The rectangle of this element
GetRectangle(FrameworkElement)
Get the bounding rectangle of this element relative to another element
Declaration
public RectangleF GetRectangle(FrameworkElement relativeTo)
Parameters
relativeTo
Returns
GetScreenRectangle()
Return the actual coordinates of this element in absolute screen coordinates taking into account the location of the overall plug-in on the page.
Declaration
public Rectangle GetScreenRectangle()
Returns
Screen coordinates of this element
Remarks
This will take into consideration any Transforms done on the element.
GetStringPresentation()
Return a string representation of this element
GetUniqueHashCode()
Calculates and returns the hash code for this element.
Highlight(bool)
Highlight this element
Declaration
public void Highlight(bool clear)
Parameters
clear
True to clear the highlight on the element.
InitKnownSilverlightControlTypes()
Declaration
public static void InitKnownSilverlightControlTypes()
InitKnownWpfControlTypes()
Declaration
public static void InitKnownWpfControlTypes()
InitKnownXamlControlTypes(Type)
Initialize all the known types
Declaration
public static void InitKnownXamlControlTypes(Type baseType)
Parameters
baseType
InitializeMappings(MappingsCollection)
Initialize the Mappings collection. This method is called when the Mappings collection is accessed for the first time. It is then cached
Declaration
public virtual void InitializeMappings(MappingsCollection mappings)
Parameters
mappings
The mappings collection to populate
IsChild(FrameworkElement)
Checks if element passed in is a child of this framework element.
Declaration
public bool IsChild(FrameworkElement element)
Parameters
element
The child to check.
Returns
True/False whether the element is a child.
IsHitTest()
Determines whether the element can be clicked/selected
IsHitTest(FrameworkElement, bool)
Determines whether [is hit test] [the specified relative parent].
Declaration
public virtual bool IsHitTest(FrameworkElement relativeParent, bool allowPartialVisibiltiy)
Parameters
relativeParent
The relative parent.
allowPartialVisibiltiy
The allow partial visibiltiy.
Returns
IsHitTest(bool)
Determines whether [is hit test] [the specified allow partial visibiltiy].
KeyPress(Keys, int, int, int)
Simulate user key press specific to this element.
Declaration
public void KeyPress(Keys key, int holdFor, int delayBetweenRepetitions, int repeatCount)
Parameters
key
The key code for the key to press.
holdFor
How long to hold the key down, in milliseconds.
delayBetweenRepetitions
The time in milliseconds to wait between key presses.
repeatCount
The count of actions to repeat.
Match(IFindExpression)
Match this FrameworkElement against a specific find expression.
Declaration
public bool Match(IFindExpression findExpr)
Parameters
findExpr
The find expression to match.
Returns
Return true/false whether the expression matches.
Implements
NextSibling(string)
Return the next sibling of this control of type.
Declaration
public FrameworkElement NextSibling(string controlType)
Parameters
controlType
The desired control type to match (i.e. 'Button', 'Calendar' ...etc)
Returns
The next sibling, else null if this control is the last sibiling.
NextSibling<T>()
The next sibling control of desired type.
Declaration
public T NextSibling<T>() where T : FrameworkElement
Returns
T
The next sibling.
Parent()
Get the parent framework element
Parent(string)
Get the parent control that matched the control type.
Declaration
public FrameworkElement Parent(string controlType)
Parameters
controlType
The desired control type to match (i.e. 'Button', 'Calendar' ...etc)
Returns
The parent object of specified type.
Parent(string, bool)
Get the parent control that matched the control type.
Declaration
public FrameworkElement Parent(string controlType, bool matchBaseType)
Parameters
controlType
The desired control type to match (i.e. 'Button', 'Calendar' ...etc)
matchBaseType
If set to true, will match a parent control that inherits from 'controlType'
Returns
The parent object of specified type.
Parent<T>()
Get the parent control of this control that is of type T.
Declaration
public T Parent<T>() where T : IFrameworkElement
Returns
T
The parent control of specified type.
Implements
Remarks
This function will traverse up the VisualTree until it finds the desired type. This function will also match custom control type that inherit from type T. For explicit matchings use Parent(string)
PreviousSibling(string)
The previous sibling control of desired type.
Declaration
public FrameworkElement PreviousSibling(string controlType)
Parameters
controlType
The desired control type to match (i.e. 'Button', 'Calendar' ...etc)
Returns
The previous sibling.
PreviousSibling<T>()
The previous sibling control of specified type.
Declaration
public T PreviousSibling<T>() where T : FrameworkElement
Returns
T
Refresh()
Refresh this FrameworkElement within the VisualTree.
Declaration
public void Refresh()
Implements
RegisterElement(Type, string)
Associate a control type with a Xaml tag.
ScrollToVisible()
Scrolls the web page so that this element is visible in the browser window
Declaration
public void ScrollToVisible()
Implements
ScrollToVisible(ScrollToVisibleType)
Scrolls the web page so that this element is visible in the browser window
Declaration
public void ScrollToVisible(ScrollToVisibleType scrollType)
Parameters
scrollType
Where in the window the the element should be after scrolling
SetAttachedProperty<T>(string, string, T)
Set value of attached property.
SetClosingTag(ITargetElement)
Ignore for the base FrameworkElement. May be overriden in a derived class to provide additional functionality.
Declaration
public void SetClosingTag(ITargetElement closingElement)
Parameters
closingElement
Whether or not to mark this element as a closing type of element.
Implements
SetDepth(int)
Set the depth of this framework element.
Declaration
public void SetDepth(int depth)
Parameters
depth
The depth to set it to.
Implements
SetFindInfo(VisualFindInfo)
Declaration
public void SetFindInfo(VisualFindInfo findInfo)
Parameters
findInfo
Implements
SetFocus()
Sets keyboard focus to this element
Declaration
public void SetFocus()
Implements
SetParent(ITargetElement)
Set the parent object of this framework element.
Declaration
public void SetParent(ITargetElement parent)
Parameters
parent
Implements
SetProperty(string, object)
Sets the property value. Will be useful for common translators supporting different technologies (SL/Wpf).
SetXamlTag(string)
Set the Xaml tag name.
Declaration
public void SetXamlTag(string tag)
Parameters
tag
The tag name.
Implements
ToRealObject()
Used internally to translate object across application boundaries
ToString()
Gets the string representation of this FrameworkElement object.
ToXml()
Gets an Xml formatted string that represents this element and all its children This Xml represents the VisualTree.
ValidateMouseLocationIfNeeded(Point)
Validate that the current location of the mouse is inside the browser window.
Declaration
public void ValidateMouseLocationIfNeeded(Point point)
Parameters
point
The coordinates of the mouse.
Exceptions
Thrown when the mouse is outside of the browser window.
ValidateType(Type, string)
Validate a control type with the control tag name.