Line Line Line Line Class
Definition
Draws a straight line between two points.
public : sealed class Line : Shape, ILinepublic sealed class Line : Shape, ILinePublic NotInheritable Class Line Inherits Shape Implements ILine// This API is not available in Javascript.
<Line .../>
- Inheritance
- Attributes
Windows 10 requirements
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
AccessKeyScopeOwnerPropertyAccessKeyScopeOwnerPropertyAccessKeyScopeOwnerPropertyAccessKeyScopeOwnerProperty
AllowFocusOnInteractionPropertyAllowFocusOnInteractionPropertyAllowFocusOnInteractionPropertyAllowFocusOnInteractionProperty
AllowFocusWhenDisabledPropertyAllowFocusWhenDisabledPropertyAllowFocusWhenDisabledPropertyAllowFocusWhenDisabledProperty
ExitDisplayModeOnAccessKeyInvokedExitDisplayModeOnAccessKeyInvokedExitDisplayModeOnAccessKeyInvokedExitDisplayModeOnAccessKeyInvoked
ExitDisplayModeOnAccessKeyInvokedPropertyExitDisplayModeOnAccessKeyInvokedPropertyExitDisplayModeOnAccessKeyInvokedPropertyExitDisplayModeOnAccessKeyInvokedProperty
FocusVisualMarginPropertyFocusVisualMarginPropertyFocusVisualMarginPropertyFocusVisualMarginProperty
FocusVisualPrimaryBrushPropertyFocusVisualPrimaryBrushPropertyFocusVisualPrimaryBrushPropertyFocusVisualPrimaryBrushProperty
FocusVisualPrimaryThicknessFocusVisualPrimaryThicknessFocusVisualPrimaryThicknessFocusVisualPrimaryThickness
FocusVisualPrimaryThicknessPropertyFocusVisualPrimaryThicknessPropertyFocusVisualPrimaryThicknessPropertyFocusVisualPrimaryThicknessProperty
FocusVisualSecondaryBrushFocusVisualSecondaryBrushFocusVisualSecondaryBrushFocusVisualSecondaryBrush
FocusVisualSecondaryBrushPropertyFocusVisualSecondaryBrushPropertyFocusVisualSecondaryBrushPropertyFocusVisualSecondaryBrushProperty
FocusVisualSecondaryThicknessFocusVisualSecondaryThicknessFocusVisualSecondaryThicknessFocusVisualSecondaryThickness
FocusVisualSecondaryThicknessPropertyFocusVisualSecondaryThicknessPropertyFocusVisualSecondaryThicknessPropertyFocusVisualSecondaryThicknessProperty
HighContrastAdjustmentPropertyHighContrastAdjustmentPropertyHighContrastAdjustmentPropertyHighContrastAdjustmentProperty
HorizontalAlignmentPropertyHorizontalAlignmentPropertyHorizontalAlignmentPropertyHorizontalAlignmentProperty
IsDoubleTapEnabledPropertyIsDoubleTapEnabledPropertyIsDoubleTapEnabledPropertyIsDoubleTapEnabledProperty
IsRightTapEnabledPropertyIsRightTapEnabledPropertyIsRightTapEnabledPropertyIsRightTapEnabledProperty
KeyTipHorizontalOffsetPropertyKeyTipHorizontalOffsetPropertyKeyTipHorizontalOffsetPropertyKeyTipHorizontalOffsetProperty
KeyTipPlacementModePropertyKeyTipPlacementModePropertyKeyTipPlacementModePropertyKeyTipPlacementModeProperty
KeyTipVerticalOffsetPropertyKeyTipVerticalOffsetPropertyKeyTipVerticalOffsetPropertyKeyTipVerticalOffsetProperty
ManipulationCompletedEventManipulationCompletedEventManipulationCompletedEventManipulationCompletedEvent
ManipulationInertiaStartingEventManipulationInertiaStartingEventManipulationInertiaStartingEventManipulationInertiaStartingEvent
ManipulationStartingEventManipulationStartingEventManipulationStartingEventManipulationStartingEvent
NoFocusCandidateFoundEventNoFocusCandidateFoundEventNoFocusCandidateFoundEventNoFocusCandidateFoundEvent
RenderTransformOriginPropertyRenderTransformOriginPropertyRenderTransformOriginPropertyRenderTransformOriginProperty
StrokeStartLineCapPropertyStrokeStartLineCapPropertyStrokeStartLineCapPropertyStrokeStartLineCapProperty
TabFocusNavigationPropertyTabFocusNavigationPropertyTabFocusNavigationPropertyTabFocusNavigationProperty
UseLayoutRoundingPropertyUseLayoutRoundingPropertyUseLayoutRoundingPropertyUseLayoutRoundingProperty
VerticalAlignmentPropertyVerticalAlignmentPropertyVerticalAlignmentPropertyVerticalAlignmentProperty
XYFocusDownNavigationStrategyXYFocusDownNavigationStrategyXYFocusDownNavigationStrategyXYFocusDownNavigationStrategy
XYFocusDownNavigationStrategyPropertyXYFocusDownNavigationStrategyPropertyXYFocusDownNavigationStrategyPropertyXYFocusDownNavigationStrategyProperty
XYFocusKeyboardNavigationXYFocusKeyboardNavigationXYFocusKeyboardNavigationXYFocusKeyboardNavigation
XYFocusKeyboardNavigationPropertyXYFocusKeyboardNavigationPropertyXYFocusKeyboardNavigationPropertyXYFocusKeyboardNavigationProperty
XYFocusLeftNavigationStrategyXYFocusLeftNavigationStrategyXYFocusLeftNavigationStrategyXYFocusLeftNavigationStrategy
XYFocusLeftNavigationStrategyPropertyXYFocusLeftNavigationStrategyPropertyXYFocusLeftNavigationStrategyPropertyXYFocusLeftNavigationStrategyProperty
XYFocusRightNavigationStrategyXYFocusRightNavigationStrategyXYFocusRightNavigationStrategyXYFocusRightNavigationStrategy
XYFocusRightNavigationStrategyPropertyXYFocusRightNavigationStrategyPropertyXYFocusRightNavigationStrategyPropertyXYFocusRightNavigationStrategyProperty
Inherited events
AccessKeyDisplayDismissedAccessKeyDisplayDismissedAccessKeyDisplayDismissedAccessKeyDisplayDismissed
AccessKeyDisplayRequestedAccessKeyDisplayRequestedAccessKeyDisplayRequestedAccessKeyDisplayRequested
ManipulationInertiaStartingManipulationInertiaStartingManipulationInertiaStartingManipulationInertiaStarting
Inherited methods
AddHandler(RoutedEvent,Object,Boolean)AddHandler(RoutedEvent,Object,Boolean)AddHandler(RoutedEvent,Object,Boolean)AddHandler(RoutedEvent,Object,Boolean)
CancelDirectManipulationsCancelDirectManipulationsCancelDirectManipulationsCancelDirectManipulations
ClearValue(DependencyProperty)ClearValue(DependencyProperty)ClearValue(DependencyProperty)ClearValue(DependencyProperty)
DeferTree(DependencyObject)DeferTree(DependencyObject)DeferTree(DependencyObject)DeferTree(DependencyObject)
FindSubElementsForTouchTargeting(Point,Rect)FindSubElementsForTouchTargeting(Point,Rect)FindSubElementsForTouchTargeting(Point,Rect)FindSubElementsForTouchTargeting(Point,Rect)
GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)GetAnimationBaseValue(DependencyProperty)
GetBindingExpression(DependencyProperty)GetBindingExpression(DependencyProperty)GetBindingExpression(DependencyProperty)GetBindingExpression(DependencyProperty)
GetChildrenInTabFocusOrderGetChildrenInTabFocusOrderGetChildrenInTabFocusOrderGetChildrenInTabFocusOrder
GetValue(DependencyProperty)GetValue(DependencyProperty)GetValue(DependencyProperty)GetValue(DependencyProperty)
GoToElementStateCore(String,Boolean)GoToElementStateCore(String,Boolean)GoToElementStateCore(String,Boolean)GoToElementStateCore(String,Boolean)
OnDisconnectVisualChildrenOnDisconnectVisualChildrenOnDisconnectVisualChildrenOnDisconnectVisualChildren
OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)
ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)ReadLocalValue(DependencyProperty)
RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)
ReleasePointerCapture(Pointer)ReleasePointerCapture(Pointer)ReleasePointerCapture(Pointer)ReleasePointerCapture(Pointer)
RemoveHandler(RoutedEvent,Object)RemoveHandler(RoutedEvent,Object)RemoveHandler(RoutedEvent,Object)RemoveHandler(RoutedEvent,Object)
SetBinding(DependencyProperty,BindingBase)SetBinding(DependencyProperty,BindingBase)SetBinding(DependencyProperty,BindingBase)SetBinding(DependencyProperty,BindingBase)
SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)SetValue(DependencyProperty,Object)
StartBringIntoView(BringIntoViewOptions)StartBringIntoView(BringIntoViewOptions)StartBringIntoView(BringIntoViewOptions)StartBringIntoView(BringIntoViewOptions)
StartDragAsync(PointerPoint)StartDragAsync(PointerPoint)StartDragAsync(PointerPoint)StartDragAsync(PointerPoint)
TransformToVisual(UIElement)TransformToVisual(UIElement)TransformToVisual(UIElement)TransformToVisual(UIElement)
TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)
TryStartDirectManipulation(Pointer)TryStartDirectManipulation(Pointer)TryStartDirectManipulation(Pointer)TryStartDirectManipulation(Pointer)
Examples
This example shows how to use the Line class to create three lines.
<Canvas Height="300" Width="300">
<!- - Draws a diagonal line from (10,10) to (50,50). - ->
<Line
X1="10" Y1="10"
X2="50" Y2="50"
Stroke="Black"
StrokeThickness="4" />
<!- - Draws a diagonal line from (10,10) to (50,50)
and moves it 100 pixels to the right. - ->
<Line
X1="10" Y1="10"
X2="50" Y2="50"
Stroke="Blue"
StrokeThickness="4"
Canvas.Left="100"/>
<!- - Draws a horizontal line from (10,60) to (150,60). - ->
<Line
X1="10" Y1="60"
X2="150" Y2="60"
Stroke="Black"
StrokeThickness="4"/>
</Canvas>
Remarks
Set the Stroke to specify the color of the line. Set the StrokeThickness property to specify the thickness of the line.
Constructors
Properties
X1 X1 X1 X1
Gets or sets the x-coordinate of the Line start point.
public : double X1 { get; set; }public double X1 { get; set; }Public ReadWrite Property X1 As double// This API is not available in Javascript.
<Line X1="double"/>
- Value
- double double double double
The x-coordinate for the start point of the line, in pixels. The default is 0.
X1Property X1Property X1Property X1Property
X2 X2 X2 X2
Gets or sets the x-coordinate of the Line end point.
public : double X2 { get; set; }public double X2 { get; set; }Public ReadWrite Property X2 As double// This API is not available in Javascript.
<Line X2="double"/>
- Value
- double double double double
The x-coordinate for the end point of the line, in pixels. The default is 0.
X2Property X2Property X2Property X2Property
Y1 Y1 Y1 Y1
Gets or sets the y-coordinate of the Line start point.
public : double Y1 { get; set; }public double Y1 { get; set; }Public ReadWrite Property Y1 As double// This API is not available in Javascript.
<Line Y1="double"/>
- Value
- double double double double
The y-coordinate for the start point of the line, in pixels. The default is 0.
Y1Property Y1Property Y1Property Y1Property
Y2 Y2 Y2 Y2
Gets or sets the y-coordinate of the Line end point.
public : double Y2 { get; set; }public double Y2 { get; set; }Public ReadWrite Property Y2 As double// This API is not available in Javascript.
<Line Y2="double"/>
- Value
- double double double double
The y-coordinate for the end point of the line, in pixels. The default is 0.