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

Ability to position Tooltip centered to target #7361

Open
nielsbosma opened this issue Jan 14, 2022 · 5 comments
Open

Ability to position Tooltip centered to target #7361

nielsbosma opened this issue Jan 14, 2022 · 5 comments

Comments

@nielsbosma
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I have a tooltip on a Slider Thumb displaying the current value:

image

I want to position the tooltip in the centre over the thumb.

Describe the solution you'd like

Add Center + Middle in PopupGravity.

Add support for AnchorAndGravity to Tooltips.

Describe alternatives you've considered

Additional context

@ahopper
Copy link
Contributor

ahopper commented Jan 14, 2022

you can trick it to almost do it with

<Slider ToolTip.Tip="{Binding $self.Value}" ToolTip.HorizontalOffset="{Binding $self.Value}" />

a converter to shrink the value would make it work better.
A bodge I know but might give a clue as how to do properly.

@maxkatz6
Copy link
Member

@ahopper if you set tooltip directly on the thumb, it might give better results
Like this https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/SliderPage.xaml#L30

@nielsbosma can you try it as well?

@ahopper
Copy link
Contributor

ahopper commented Jan 14, 2022

That works well, a much better solution. I've switched out all my sliders for thumbwheels so am not actually using dynamic tooltips anymore but good to know.

@nielsbosma
Copy link
Contributor Author

I am setting the tooltip on the thumb. The issue is the positioning of the tooltip over the thumb.

@nielsbosma
Copy link
Contributor Author

I figured out a workaround. I add a fixed width outer panel to the tooltip and then use horizontaloffset.

image

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

No branches or pull requests

3 participants