Class CompareSlider
A control that allows comparing two pieces of content side-by-side with a draggable slider. Inherits from Avalonia.Controls.Primitives.RangeBase, so Avalonia.Controls.Primitives.RangeBase.Value in the range [Avalonia.Controls.Primitives.RangeBase.Minimum, Avalonia.Controls.Primitives.RangeBase.Maximum] maps to the divider position.
[TemplatePart("PART_BeforePanel", typeof(Panel))]
[TemplatePart("PART_AfterPanel", typeof(Panel))]
[TemplatePart("PART_Divider", typeof(Line))]
[TemplatePart("PART_Thumb", typeof(Thumb))]
[PseudoClasses(new string[] { ":dragging", ":horizontal", ":vertical" })]
public class CompareSlider : RangeBase, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlRangeBaseCompareSlider
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentINamedIInputElementIDataTemplateHostISetterValue
- Inherited Members
-
RangeBase.MinimumPropertyRangeBase.MaximumPropertyRangeBase.ValuePropertyRangeBase.SmallChangePropertyRangeBase.LargeChangePropertyRangeBase.ValueChangedEventRangeBase.OnInitialized()RangeBase.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)RangeBase.OnDataContextBeginUpdate()RangeBase.OnDataContextEndUpdate()RangeBase.MinimumRangeBase.MaximumRangeBase.ValueRangeBase.SmallChangeRangeBase.LargeChangeRangeBase.ValueChangedTemplatedControl.BackgroundPropertyTemplatedControl.BackgroundSizingPropertyTemplatedControl.BorderBrushPropertyTemplatedControl.BorderThicknessPropertyTemplatedControl.CornerRadiusPropertyTemplatedControl.FontFamilyPropertyTemplatedControl.FontFeaturesPropertyTemplatedControl.FontSizePropertyTemplatedControl.FontStylePropertyTemplatedControl.FontWeightPropertyTemplatedControl.FontStretchPropertyTemplatedControl.ForegroundPropertyTemplatedControl.LetterSpacingPropertyTemplatedControl.PaddingPropertyTemplatedControl.TemplatePropertyTemplatedControl.IsTemplateFocusTargetPropertyTemplatedControl.TemplateAppliedEventTemplatedControl.GetIsTemplateFocusTarget(Control)TemplatedControl.ApplyTemplate()TemplatedControl.GetTemplateFocusTarget()TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)TemplatedControl.BackgroundTemplatedControl.BackgroundSizingTemplatedControl.BorderBrushTemplatedControl.BorderThicknessTemplatedControl.CornerRadiusTemplatedControl.FontFamilyTemplatedControl.FontFeaturesTemplatedControl.FontSizeTemplatedControl.FontStyleTemplatedControl.FontWeightTemplatedControl.FontStretchTemplatedControl.ForegroundTemplatedControl.LetterSpacingTemplatedControl.PaddingTemplatedControl.TemplateTemplatedControl.TemplateAppliedControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.OnLoaded(RoutedEventArgs)Control.OnUnloaded(RoutedEventArgs)Control.OnSizeChanged(SizeChangedEventArgs)Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnGotFocus(FocusChangedEventArgs)Control.OnLostFocus(FocusChangedEventArgs)Control.OnPointerReleased(PointerReleasedEventArgs)Control.OnKeyUp(KeyEventArgs)Control.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.GettingFocusEventInputElement.LostFocusEventInputElement.LosingFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.ContextRequestedEventInputElement.ContextCanceledEventInputElement.IsHoldingEnabledPropertyInputElement.IsHoldWithMouseEnabledPropertyInputElement.PinchEventInputElement.PinchEndedEventInputElement.PullGestureEventInputElement.PullGestureEndedEventInputElement.SwipeGestureEventInputElement.SwipeGestureEndedEventInputElement.ScrollGestureEventInputElement.ScrollGestureInertiaStartingEventInputElement.ScrollGestureEndedEventInputElement.PointerTouchPadGestureMagnifyEventInputElement.PointerTouchPadGestureRotateEventInputElement.PointerTouchPadGestureSwipeEventInputElement.TappedEventInputElement.RightTappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.OnAccessKey(RoutedEventArgs)InputElement.OnGettingFocus(FocusChangingEventArgs)InputElement.OnLosingFocus(FocusChangingEventArgs)InputElement.OnTextInput(TextInputEventArgs)InputElement.OnPointerEntered(PointerEventArgs)InputElement.OnPointerExited(PointerEventArgs)InputElement.OnPointerMoved(PointerEventArgs)InputElement.GetNextTabStopOverride()InputElement.GetPreviousTabStopOverride()InputElement.GetFirstFocusableElementOverride()InputElement.GetLastFocusableElementOverride()InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)InputElement.OnPointerWheelChanged(PointerWheelEventArgs)InputElement.OnTapped(TappedEventArgs)InputElement.OnRightTapped(TappedEventArgs)InputElement.OnDoubleTapped(TappedEventArgs)InputElement.OnHolding(HoldingRoutedEventArgs)InputElement.UpdateIsEffectivelyEnabled()InputElement.GetIsHoldingEnabled(StyledElement)InputElement.GetIsHoldWithMouseEnabled(StyledElement)InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.IsEnabledCoreInputElement.GestureRecognizersInputElement.GotFocusInputElement.GettingFocusInputElement.LostFocusInputElement.LosingFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.ContextRequestedInputElement.ContextCanceledInputElement.PinchInputElement.PinchEndedInputElement.PullGestureInputElement.PullGestureEndedInputElement.ScrollGestureInputElement.ScrollGestureInertiaStartingInputElement.ScrollGestureEndedInputElement.PointerTouchPadGestureMagnifyInputElement.PointerTouchPadGestureRotateInputElement.SwipeGestureInputElement.SwipeGestureEndedInputElement.PointerTouchPadGestureSwipeInputElement.TappedInputElement.RightTappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Interactive.BuildEventRoute(RoutedEvent)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])Layoutable.AffectsArrange<T>(params AvaloniaProperty[])Layoutable.MeasureCore(Size)Layoutable.MeasureOverride(Size)Layoutable.ArrangeCore(Rect)Layoutable.ArrangeOverride(Size)Layoutable.OnMeasureInvalidated()Layoutable.OnVisualParentChanged(Visual, Visual)Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.CacheModePropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.Render(DrawingContext)Visual.AffectsRender<T>(params AvaloniaProperty[])Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)Visual.InvalidateMirrorTransform()Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.CacheModeVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.VisualChildrenVisual.VisualRootVisual.BypassFlowDirectionPoliciesVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.BeginInit()StyledElement.EndInit()StyledElement.ApplyStyling()StyledElement.InitializeIfNeeded()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.LogicalChildrenStyledElement.PseudoClassesStyledElement.StyleKeyOverrideStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)Animatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.Bind(AvaloniaProperty, BindingBase)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)AvaloniaObject.InheritanceParentAvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.DispatcherAvaloniaObject.PropertyChanged
Constructors
CompareSlider()
public CompareSlider()
Fields
AfterContentProperty
Identifies the AfterContent property.
public static readonly StyledProperty<object?> AfterContentProperty
Field Value
- StyledProperty<object>
AfterContentTemplateProperty
Identifies the AfterContentTemplate property.
public static readonly StyledProperty<IDataTemplate?> AfterContentTemplateProperty
Field Value
- StyledProperty<IDataTemplate>
BeforeContentProperty
Identifies the BeforeContent property.
public static readonly StyledProperty<object?> BeforeContentProperty
Field Value
- StyledProperty<object>
BeforeContentTemplateProperty
Identifies the BeforeContentTemplate property.
public static readonly StyledProperty<IDataTemplate?> BeforeContentTemplateProperty
Field Value
- StyledProperty<IDataTemplate>
DragCompletedEvent
Identifies the DragCompleted event.
public static readonly RoutedEvent<VectorEventArgs> DragCompletedEvent
Field Value
- RoutedEvent<VectorEventArgs>
DragDeltaEvent
Identifies the DragDelta event.
public static readonly RoutedEvent<VectorEventArgs> DragDeltaEvent
Field Value
- RoutedEvent<VectorEventArgs>
DragStartedEvent
Identifies the DragStarted event.
public static readonly RoutedEvent<VectorEventArgs> DragStartedEvent
Field Value
- RoutedEvent<VectorEventArgs>
IsDirectionReversedProperty
Identifies the IsDirectionReversed property.
public static readonly StyledProperty<bool> IsDirectionReversedProperty
Field Value
- StyledProperty<bool>
IsDraggingProperty
Identifies the IsDragging property.
public static readonly DirectProperty<CompareSlider, bool> IsDraggingProperty
Field Value
- DirectProperty<CompareSlider, bool>
IsMoveToPointEnabledProperty
Identifies the IsMoveToPointEnabled property.
public static readonly StyledProperty<bool> IsMoveToPointEnabledProperty
Field Value
- StyledProperty<bool>
OrientationProperty
Identifies the Orientation property.
public static readonly StyledProperty<Orientation> OrientationProperty
Field Value
- StyledProperty<Orientation>
Properties
AfterContent
Gets or sets the content displayed on the "after" (right/bottom) side of the divider.
public object? AfterContent { get; set; }
Property Value
AfterContentTemplate
Gets or sets the data template used to display AfterContent.
public IDataTemplate? AfterContentTemplate { get; set; }
Property Value
- IDataTemplate
BeforeContent
Gets or sets the content displayed on the "before" (left/top) side of the divider.
public object? BeforeContent { get; set; }
Property Value
BeforeContentTemplate
Gets or sets the data template used to display BeforeContent.
public IDataTemplate? BeforeContentTemplate { get; set; }
Property Value
- IDataTemplate
IsDirectionReversed
Gets or sets a value indicating whether the direction of increasing Avalonia.Controls.Primitives.RangeBase.Value is reversed relative to the visual position of the divider.
public bool IsDirectionReversed { get; set; }
Property Value
IsDragging
Gets a value indicating whether the thumb is currently being dragged.
public bool IsDragging { get; }
Property Value
IsMoveToPointEnabled
Gets or sets a value indicating whether clicking anywhere on the control moves the divider to that point. Defaults to true.
public bool IsMoveToPointEnabled { get; set; }
Property Value
Orientation
Gets or sets the axis along which the divider moves. Defaults to horizontal orientation.
public Orientation Orientation { get; set; }
Property Value
- Orientation
Methods
AnimateTo(double, TimeSpan?, CancellationToken)
Animates the divider to the specified value position.
Any in-progress animation is cancelled before the new one starts.
public Task AnimateTo(double value, TimeSpan? duration = null, CancellationToken cancellationToken = default)
Parameters
valuedoubleTarget value, clamped to [Avalonia.Controls.Primitives.RangeBase.Minimum, Avalonia.Controls.Primitives.RangeBase.Maximum].
durationTimeSpan?Animation duration. Defaults to 300 ms.
cancellationTokenCancellationTokenToken to cancel the animation externally.
Returns
OnApplyTemplate(TemplateAppliedEventArgs)
Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameters
eTemplateAppliedEventArgsThe event args.
OnCreateAutomationPeer()
Returns a new, type-specific Avalonia.Automation.Peers.AutomationPeer implementation for the control.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer
The type-specific Avalonia.Automation.Peers.AutomationPeer implementation.
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is removed from a rooted visual tree.
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
eVisualTreeAttachmentEventArgsThe event args.
OnKeyDown(KeyEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.KeyDownEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsData about the event.
OnPointerPressed(PointerPressedEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerPressedEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerPressed(PointerPressedEventArgs e)
Parameters
ePointerPressedEventArgsData about the event.
Reset(bool)
Moves the divider to the center of the value range.
public Task Reset(bool animate = true)
Parameters
Returns
- Task
A Task that completes when the divider reaches the center. Returns a completed task when
animateis false.
Events
DragCompleted
Occurs when the thumb drag is completed.
public event EventHandler<VectorEventArgs> DragCompleted
Event Type
- EventHandler<VectorEventArgs>
DragDelta
Occurs each time the thumb moves during a drag operation.
public event EventHandler<VectorEventArgs> DragDelta
Event Type
- EventHandler<VectorEventArgs>
DragStarted
Occurs when the thumb drag begins.
public event EventHandler<VectorEventArgs> DragStarted
Event Type
- EventHandler<VectorEventArgs>