-
Notifications
You must be signed in to change notification settings - Fork 796
Closed
Labels
feature proposalNew feature proposalNew feature proposal
Description
Proposal: Add OnThumbDragStarted and OnThumbDragCompleted Events to WinUI3 Slider Control
Summary
Propose adding OnThumbDragStarted and OnThumbDragCompleted events to the WinUI3 Slider control to enable developers to track when a user begins and ends thumb dragging. This aligns with UWP/WPF's Thumb.DragStarted, Thumb.DragCompleted/OnThumbDragStarted , OnThumbDragStarted events.
Rationale
- Migrating UWP/WPF Developers: Developers porting apps from UWP/WPF to WinUI3 require feature parity. The absence of drag-tracking events forces functions loss, workarounds, complicating code and reducing maintainability.
- User Experience Enhancements: Enables scenarios like deferred UI updates until dragging completes (e.g., pausing real-time data rendering during drags to optimize performance).
- Consistency with XAML Ecosystem: Matches standard
Sliderbehavior in other Microsoft XAML frameworks, reducing learning curve friction.
Scope
| Capability | Priority |
|---|---|
Expose OnThumbDragStarted event when thumb dragging begins |
Must |
Expose OnThumbDragCompleted event when thumb dragging ends |
Must |
| Provide event arguments containing drag offset data | Should |
Include a OnThumbDragDelta event for intermediate drag updates |
Could |
Important Notes
API Proposal:
public class Slider : RangeBase
{
public event DragStartedEventHandler OnThumbDragStarted;
public event DragCompletedEventHandler OnThumbDragCompleted;
}
// Event arguments (reuse existing WinUI types):
public class DragStartedEventArgs : RoutedEventArgs { /* Horizontal/VerticalOffset */ }
public class DragCompletedEventArgs : RoutedEventArgs { /* Canceled, HorizontalChange, VerticalChange*/ } Usage Example:
mySlider.OnThumbDragStarted+= (s, e) => { };
mySlider.OnThumbDragCompleted+= (s, e) => { }; Design Alignment:
- Mirrors UWP’s
Sliderevent model. - Avoids breaking changes by reusing
Microsoft.UI.Xaml.Controls.Primitivesevent handlers.
Open Questions
- Should
OnThumbDragDelta(continuous drag updates) be included in this proposal? - Is there a need for cancelation support (e.g., if a drag is interrupted by system events)?
- Should these events be added to other
RangeBasecontrols (e.g.,ScrollBar,ProgressBar)?
This proposal directly addresses the gap in WinUI3’s Slider control while prioritizing migration compatibility and user experience.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature proposalNew feature proposalNew feature proposal