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

Use DataTemplate in RangeSlider instead of a Converter (AutoToolTipContentTemplate) #2784

Closed
wants to merge 23 commits into from

Conversation

Anapher
Copy link
Contributor

@Anapher Anapher commented Dec 28, 2016

I know, I did implemented the DependencyProperty AutoToolTipTextConverter in #1833 but I think a DataTemplate would fit much better because of obvious reasons: No need to write a new IValueConverter for every RangeSlider, more possiblities (coloring, font, icons, etc.) and it's the default in WPF.

It was fairly complicated to implement that (because two values are displayed when moving the range and I didn't want to change the default behavior) but I think it works pretty good. Here is a small example about how to use it:

                    <Controls:RangeSlider [...]>
                        <Controls:RangeSlider.AutoToolTipContentTemplate>
                            <DataTemplate>
                                <TextBlock>
                                    <Run Foreground="Red" Text="{Binding Mode=OneWay, StringFormat=#.00}" />
                                    <Run Text="Punks" />
                                </TextBlock>
                            </DataTemplate>
                        </Controls:RangeSlider.AutoToolTipContentTemplate>
                    </Controls:RangeSlider>

Result:
Default Moving
Move Range

@punker76 punker76 added this to the 2.0.0 milestone Jan 27, 2019
punker76 added a commit that referenced this pull request Jan 27, 2019
…llow setting a DataTemplate for the AutoToolTip values (AutoToolTipLowerValueTemplate, AutoToolTipUpperValueTemplate, AutoToolTipRangeValuesTemplate)

Introduce also a helper class RangeSliderAutoTooltipValues which is used as the ToolTip content for the AutoToolTipRangeValuesTemplate
@punker76 punker76 removed the Feature label Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants