Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider's Thumb.DragStarted and Thumb.DragCompleted aren't working #4210

Closed
define-private-public opened this issue Jul 1, 2020 · 6 comments

Comments

@define-private-public
Copy link

I have this XAML:

        <Slider DockPanel.Dock="Right"
                Orientation="Horizontal"
                Value="{Binding PlaybackSliderValue}"
                Thumb.DragStarted="OnPlaybackSliderDragStarted"
                Thumb.DragCompleted="OnPlaybackSliderDragCompleted"
                Minimum="0"
                Maximum="1000000"/>

I see in the Avalonia repo that DragStarted and DragCompleted are in Thumb, but when I tried to attach my handlers to them, I was treated with this at the dotnet run level:

/home/ben/Projects/AvaloniaSamples/BassoonJukebox/Views/JukeboxView.xaml(68,10,68,10): Avalonia error XAMLIL: Unable to resolve suitable regular or attached property DragStarted on type Avalonia.Controls:Avalonia.Controls.Primitives.Thumb (line 68 position 10) Line 68, position 10. [/home/ben/Projects/AvaloniaSamples/BassoonJukebox/BassoonJukebox.csproj]

The build failed. Fix the build errors and run again.
@define-private-public
Copy link
Author

If I wanted to implement support for this myself and then submit the PR, what would I need to do?

@jmacato
Copy link
Member

jmacato commented Jul 2, 2020

If you want to override the properties of slider, it's best if you just make a new control with Slider as base class... but if you need some kind of slider for a media player, take a look at this code: https://github.com/jmacato/Synfonia/blob/master/Synfonia.Gui/Controls/SeekSlider.cs

@define-private-public
Copy link
Author

I'm moreso trying to make some simple demo apps for Avalonia right now. (Mainly as a way to learn the API). I'm trying to port over a tiny audio player app I made in GtkSharp. The slider was used to show where playback was for the user, but also they could click on the thumb and drag to to change the location in the music.

@xiaokun
Copy link

xiaokun commented Aug 12, 2022

I had the same problem. This bug seems to be still unresolved in the latest version (0.10.17). Is there any other solution to this problem now? Many thanks.

@maxkatz6
Copy link
Member

Routed attached events are not supported in the XAML,
duplicate of #4009

@maxkatz6 maxkatz6 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 2022
@maxkatz6
Copy link
Member

maxkatz6 commented Aug 13, 2022

@xiaokun you can do it from the code behind or write a behavior (using Behaviors SDK).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants