Elements Element Class
Elements are visuals that cover a rectangular 2D region.
Common properties
HitTestMode
When interacting with an element, it is sometimes desirable to be able to differentiate which elements can be interacted with and how. This is typically referred to as "hit testing". In Fuse, how elements interact with user input can be set using HitTestMode
.
Example
This example will layout two Rectangle
s and add Clicked
-triggers to both of them. However, only the left one will output anything when clicked, as the hit testing has been explicitly disabled on the right rectangle:
<Grid ColumnCount="2">
<Rectangle Width="100" Height="100" Fill="#808" >
<Clicked>
<DebugAction Message="Clicked left" />
</Clicked>
</Rectangle>
<Rectangle Width="100" Height="100" Fill="#808" HitTestMode="None" >
<Clicked>
<DebugAction Message="Clicked right" />
</Clicked>
</Rectangle>
</Grid>
This can be very helpful if you have visual elements obscuring elements below it, where you want the lower elements respond to input.
ClipToBounds
Normally, when laying out an element inside the other, the inner element can freely live outside the parent element:
<Panel Width="100" Height="100">
<Image Margin="-100" File="Pictures/Picture1.jpg" StretchMode="UniformToFill" />
</Panel>
This Image
will appear to be 300pt wide and tall, as the Panel
doesn't clip children to its bounds.
If you intend to have the Image
clip to its parent size, simply set ClipToBounds="true"
on the Panel
:
<Panel Width="100" Height="100" ClipToBounds="true">
<Image Margin="-100" File="Pictures/Picture1.jpg" StretchMode="UniformToFill" />
</Panel>
Now, the Image
will not overflow the bounds of the Panel
.
Opacity
You can set the transparency of objects using the Opacity
-property. When Opacity="0"
, the element is completely transparent.
Example
In this example, a panel's opacity is set to 0.5
<Panel>
<Opacity Value="0.5" />
</Panel>
Layers
It is often helpful to redefine what existing controls should look like. Elements that are added to containers can be assigned to different layers. If you want a button to appear with a red background, you can redefine its Background
Layer
:
<Button Text="Hello!">
<Rectangle Fill="#931" Layer="Background" />
</Button>
This will not change the layout or behavior of the Button, but its appearance will change.
Available Element classes
Arc ux
BackButton uno
BackButton uno
BackButton ux
Body uno
BodyBold uno
BottomBarBackground ux
BottomFrameBackground ux
Bubble uno
Bubbles uno
A row of partially overlapping Bubbles.
Button uno
Button ux
ButtonBase ux
ButtonText uno
CallToActionButton uno
CameraView ux
Card uno
Cards are generally light. Thus, they have an implicit LightTheme by default. You can disable this behavior by using its base class, ThemedCard instead.
CardBody uno
A StackPanel with the right margins and spacing for text content in a Card.
CardMedia uno
Carousel uno
CarouselPage uno
A page in a Carousel. Provides no visuals, only animation.
Circle ux
ClientPanel ux
CollectionPanel ux
ColorBadge uno
Container ux
ContentControl ux
ContentGradient uno
A Rectangle with a gradient fading out near the bottom of an element.
Curve ux
DatePicker ux
DockPanel ux
Donut uno
Drawer uno
DrawerButtonBackground uno
A Panel with the same height as the floating button of a Drawer.
DrawingPanel ux
DrawingPanelBase ux
A Panel that can be used to draw lines using your finger. As the DrawingPanel is native only, it must be contained in a NativeViewHost.
EdgeNavigator ux
Ellipse ux
FlatCarousel uno
FlatCarouselPage uno
A page in a FlatCarousel.
GraphicsView ux
Grid ux
Icon uno
IconLabel uno
A text label with an Icon docked to its left.
Image ux
InnerSwitch uno
LayoutControl ux
ListView uno
ListViewHeader uno
A colored header bar with text, used to display the category of a group of items.
MapView ux
MediaScroller uno
MultiLayoutPanel ux
Allows you to move Elements between different layouts using the Placeholder
class.
NativeViewHost ux
NavBar uno
A navigation bar including StatusBarBackground. Children are placed inside a DockPanel.
NavBarTitle uno
NavigationBar uno
NavigationBar ux
Navigator ux
Number ux
Deprecated, for backwards compatibility
Page uno
A Page that takes its background color from the currently active theme.
Page ux
PageControl ux
PageIndicator ux
Builds indicator icons for each page of a PageControl based on a specified template, and displays them next to each other. To use it, you have to provide a template named Dot
,
as well as providing a PageControl to listen to through the Navigation
property.
PageIndicatorDot ux
PageView ux
A Navigator without standard transitions. This is convenient when you want to provide custom transitions for all pages.
Panel ux
PartialTabPage uno
A variant of TabPage that keeps the previous and next pages partially in view.
Path ux
PhotoPreview uno
Placeholder ux
Plot ux
A panel that contains a chart.
PlotAxis ux
PlotBar ux
PlotPoint ux
PlotTicks ux
PlotWedge ux
RadarPlot uno
A radar-style Plot for a single data series of exactly six data points.
RangeControl ux
RangeControl2D ux
Rectangle ux
RegularPolygon ux
Draws a polygon with a number of equal length sides.
Resources uno
RootGraphicsView ux
SafeEdgePanel ux
ScrollView ux
ScrollViewBase ux
Slider uno
A slider control. Has the same interface as any other RangeControl, such as the default Slider.
Slider uno
Slider ux
StackPanel ux
Star ux
StatusBarBackground ux
StickyHeader uno
Subtitle uno
SwipeActionPanel uno
Switch uno
Switch uno
Switch ux
TabBar uno
A PageIndicator that uses values provided by the Label
property of TabPage
to instantiate tabs with text labels for each page in a PageControl or other LinearNavigation.
TabPage uno
A Page that exports a title for use with TabPageControl or TabBar.
TabPageControl uno
Combines a TabBar and a PageControl.
TestRootPanel ux
Text uno
Text ux
TextBlock ux
Deprecated, for backwards compatibility
TextBox ux
A TextInput with a default look and feel.
TextInput uno
TextInput ux
TextStyles uno
TextView ux
ThemedCard uno
A Card that takes its background color from the currently active theme.
TimePicker ux
Title uno
TitlePanel uno
ToggleControl ux
TopFrameBackground ux
UnderlineTitle uno
VectorLayer ux
Video ux
Viewbox ux
Viewport uno
WebView ux
WrapPanel ux
Location
- Namespace
- Fuse.Elements
- Package
- Fuse.Elements 2.9.1
Interface of Element
ActualAnchor : float2 uno
ActualPosition : float2 uno
ActualSize : float2 uno
Alignment : Alignment ux
The Alignment of the Element
.
Anchor : Size2 ux
ArrangePaddingBox(LayoutParams) uno
Aspect : float ux
AspectConstraint : AspectConstraint ux
Determines how the aspect ratio is maintained in a situation when it violates the min or max sizing constraints.
BoxSizing : BoxSizingMode ux
The manner in which the size and position of the element is calculated.
CachingMode : CachingMode ux
CalcRenderBounds : VisualBounds uno
CalcRenderBoundsWithEffects : VisualBounds uno
CaptureRegion(DrawContext, Rect, float2) : framebuffer uno
ClipToBounds : bool ux
Clips the child elements to the bounds of this element visually.
DefaultAspect : float uno
DefaultAspectConstraint : AspectConstraint uno
DefaultCachingMode : CachingMode uno
DefaultHitTestMode : HitTestMode uno
DefaultOpacity : float uno
DefaultTransformOrigin : ITransformOrigin uno
DrawNonUnderlayChildren(DrawContext) uno
DrawUnderlayChildren(DrawContext) uno
DrawWithChildren(DrawContext) uno
Element Constructor uno
Creates a new Element
ExplicitTransformOrigin : Size2 ux
ExplicitTransformOriginName : Selector uno
FastTrackDrawWithOpacity(DrawContext) : bool uno
GetContentSize(LayoutParams) : float2 uno
GetVisibleViewportInvertPixelRect(DrawContext, VisualBounds) : Recti uno
Height : Size ux
HitTestLocalVisualBounds : VisualBounds uno
HitTestMode : HitTestMode ux
Specifies how hit tests should be performed on this element.
InvalidateRenderBoundsWithEffects uno
IsPointInside(float2) : bool uno
IsSelectionParentOf(Element) : bool uno
LimitHeight : Size ux
The height limit for an element using BoxSizing="Limit"
.
LimitWidth : Size ux
The width limit for an element using BoxSizing="Limit"
.
Margin : float4 ux
MaxHeight : Size ux
MaxWidth : Size ux
MinHeight : Size ux
MinWidth : Size ux
Offset : Size2 ux
OnDraw(DrawContext) uno
OnHitTestLocalVisual(HitTestContext) uno
Opacity : float ux
Padding : float4 ux
Placed : PlacedHandler (object, PlacedArgs) ux
Position : Size2 ux
RenderBoundsWithEffects : VisualBounds uno
RenderBoundsWithoutEffects : VisualBounds uno
SetExplicitTransformOrigin(Size2, IPropertyListener) uno
SetHitTestMode(HitTestMode, IPropertyListener) uno
SetOpacity(float, IPropertyListener) uno
SetVisibility(Visibility, IPropertyListener) uno
Size : Size2 ux
TransformOrigin : ITransformOrigin ux
TreeRenderer : ITreeRenderer uno
Visibility : Visibility ux
The Visibility of the Element
.
Width : Size ux
X : Size ux
Y : Size ux
Inherited from Visual
AbsoluteViewportOrigin : float2 uno
AbsoluteZoom : float uno
Add(Node) uno
AddDrawCost(double) uno
ArrangeMarginBox(float2, LayoutParams) : float2 uno
BeginInteraction(object, Action) uno
BeginRemoveChild(Node, Action<Node> (Node)) uno
Begins removing a given node, playing all RemovedAnimations before actual removal.
BeginRemoveVisual(Visual, Action<Node> (Node)) uno
Begins removing a given visual, playing all RemovedAnimations before actual removal.
BringIntoView uno
bringIntoView() js
Requests that this visual be brought into the visible are of the screen. Typically a containing
ScrollView
will scroll to ensure it is visible.
BringToFront(Visual) uno
Brings the given child to the front of the Z-order. In UX markup, use the BringToFront trigger action instead.
CancelInteractions(CancelInteractionsType) uno
ChildCount : int uno
The number of child nodes of this visual.
Children : IList of Node ux
The children of the visual. All nodes placed inside the visual in UX markup are assigned to this list. The order of Visuals this list determines the order of layout. The Z-order of the children is by default equal to this order, but can be manipulated separately using methods like BringToFront and SendToBack.
Draw(DrawContext) uno
DrawCost : double uno
EndInteraction(object) uno
FindTemplate(string) : Template uno
FindViewport : IViewport uno
FirstChild<T> : T uno
GetHitWindowPoint(float2) : Visual uno
GetMarginSize(LayoutParams) : float2 uno
GetTransformTo(Visual) : float4x4 uno
GetZOrderChild(int) : Visual uno
HasChildren : bool uno
HasPendingRemove : bool uno
HasVisualChildren : bool uno
Whether this visual has any visual child nodes.
HitTest(HitTestContext) uno
HitTestBounds : VisualBounds uno
HitTestChildrenBounds : VisualBounds uno
HitTestLocalBounds : VisualBounds uno
IfSnap(float2) : float2 uno
IfSnapDown(float2) : float2 uno
IfSnapUp(float2) : float2 uno
Insert(int, Node) uno
InsertAfter(Node, Node) uno
InvalidateHitTestBounds uno
InvalidateLayout(InvalidateLayoutReason) uno
InvalidateLocalTransform uno
InvalidateRenderBounds uno
InvalidateVisual uno
Indicates the visual for this node has changed. This allows the root-level node to know that it must draw, and any caching that it must invalidate the cache for this node.
InvalidateVisualComposition uno
Indicates the composition of the visual has changed, but that the visual drawing itself is still valid (for example a position change).
IsContextEnabled : bool uno
Whether this node is in an enabled context.
The context is disabled if one of the ancestor nodes have IsEnabled set to false
.
IsEnabled : bool ux
IsInteracting : bool uno
IsLocalVisible : bool uno
Returns whether this visual is visible without concern for whether an ancestor visual is hidden or collapsed.
IsMarginBoxDependent(Visual) : LayoutDependent uno
IsVisible : bool uno
Returns whether this visual is currently visible. Will return false if any of the ancestor visuals are hidden or collapsed. This property can not be used to check whether a visual is hidden because it is occluded by another visual, or is outside the view but otherwise visible.
LastChild<T> : T uno
Layer : Layer ux
The layer this visual belongs to in the Parent container.
LayoutRole : LayoutRole ux
Describes how this visual participates in layout.
LocalBounds : Box uno
LocalRenderBounds : VisualBounds uno
LocalToParent(float2) : float2 uno
Converts a coordinate from the local space into the parent space.
LocalTransform : float4x4 uno
LocalTransformInternal : FastMatrix uno
LocalTransformInverse : float4x4 uno
OnArrangeMarginBox(float2, LayoutParams) : float2 uno
OnBeginRemoveVisual(PendingRemoveVisual) uno
OnChildAdded(Node) uno
OnChildMoved(Node) uno
OnChildRemoved(Node) uno
OnHitTest(HitTestContext) uno
OnInvalidateLayout uno
OnInvalidateRenderBounds : bool uno
OnInvalidateVisual uno
OnInvalidateVisualComposition uno
OnIsContextEnabledChanged uno
OnIsSelectedChanged(bool) uno
OnIsVisibleChanged uno
OnLocalVisibleChanged uno
onParameterChanged(callback) js
OnPropertyChanged(PropertyObject, Selector) uno
OnRootedPreChildren uno
OnZOrderInvalidated uno
Parameter : string ux
PerformLayout uno
PerformLayout(float2) uno
PrependImplicitTransform(FastMatrix) uno
PrependInverseTransformOrigin(FastMatrix) uno
PrependTransformOrigin(FastMatrix) uno
Remove(Node) : bool uno
RemoveAllChildren<T> uno
RemoveDrawCost(double) uno
Resources : IList of Resource ux
The list of resources defined at this node.
SendToBack(Visual) uno
Sends the given child to the back of the Z-order. In UX markup, use the SendToBack trigger action instead.
SetResource(string, object) uno
Snap(float2) : float2 uno
SnapDown(float2) : float2 uno
SnapToPixels : bool ux
Whether to snap the result of layout of this visual to physical device pixels.
SnapUp(float2) : float2 uno
Templates : IList of Template ux
TryParentToLocal(float2, float2) : bool uno
Converts a coordinate from the parent space into the local space.
ValidFrameCount : int uno
ViewHandle : ViewHandle uno
Viewport : IViewport uno
VisualChildCount : int uno
The number of child visuals of this visual.
VisualContext : VisualContext uno
WindowToLocal(float2) : float2 uno
WorldPosition : float3 uno
WorldTransform : float4x4 uno
WorldTransformInverse : float4x4 uno
ZOffset : float ux
Inherited from Node
Add(Binding) uno
Bindings : IList of Binding ux
The list of bindings belonging to this node.
ContextParent : Node uno
The context parent is the semantic parent of this node. It is where non-UI structure should be resolved, like looking for the DataContext, a Navigation, or other semantic item.
FindByType<T> : T uno
FindNodeByName(Selector, Predicate<Node> (Node)) : Node uno
Finds the first node with a given name that satisfies the given acceptor. The serach algorithm works as follows: Nodes in the subtree are matched first, then it matches the nodes in the subtrees ofthe ancestor nodes by turn all the way to the root. If no matching node is found, the function returns null.
GetNearestAncestorOfType<T> : T uno
Insert(int, Binding) uno
IsRootingCompleted : bool uno
Whether rooting for this node is completed. Returns false if unrooting has started.
IsRootingStarted : bool uno
Whether rooting of this node has started. Note that even if this property returns true, rooting may not yet be completed for the node. See also IsRootingCompleted.
Name : Selector ux
Run-time name of the node. This property is automatically set using the ux:Name attribute.
NextSibling<T> : T uno
Returns the next sibling node of the given type.
OnDataChanged(string, object) uno
OnRooted uno
If you override OnRooted
you must call base.OnRooted()
first in your derived class. No other processing should happen first, otherwise you might end up in an undefined state.
OnUnrooted uno
Parent : Visual uno
The parent Visual of this node. Will return null if the node is not rooted.
PreviousSibling<T> : T uno
Returns the next sibling node of the given type.
Properties : Properties uno
A linked list holding data for extrinsic properties.
Remove(Binding) : bool uno
SoftDispose uno
SourceFileName : string ux
hide
SourceLineNumber : int ux
hide
SubtreeToString : string uno
SubtreeToString(StringBuilder, int) uno
TryGetResource(string, Predicate<object> (object), object) : bool uno
VisitSubtree(Action<Node> (Node)) uno
Inherited from PropertyObject
AddPropertyListener(IPropertyListener) uno
OnPropertyChanged(Selector, IPropertyListener) uno
OnPropertyChanged(Selector) uno
RemovePropertyListener(IPropertyListener) uno
Inherited from object
Equals(object) : bool uno
GetHashCode : int uno
GetType : Type uno
ToString : string uno
Implemented Interfaces
IShow uno
IHide uno
ICollapse uno
IActualPlacement uno
IResize uno
IList<Node> uno
IPropertyListener uno
ITemplateSource uno
IEnumerable<Visual> uno
ICollection<Node> uno
IEnumerable<Node> uno
IList<Binding> uno
IScriptObject uno
Interface for objects that can have a script engine representation
IProperties uno
ISourceLocation uno
hide