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

Add DataTemplates for range slider auto tool tip values #3440

Conversation

punker76
Copy link
Member

Describe the changes you have made to improve this project

Remove AutoToolTipTextConverter and add new properties to allow 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.

Example

<Controls:RangeSlider Width="200"
                      Margin="4"
                      Controls:SliderHelper.ChangeValueBy="LargeChange"
                      Controls:SliderHelper.EnableMouseWheel="MouseHover"
                      AutoToolTipPlacement="TopLeft"
                      LargeChange="10"
                      LowerValue="40"
                      Maximum="100"
                      Minimum="0"
                      Orientation="Horizontal"
                      SmallChange="1"
                      Style="{DynamicResource MahApps.Metro.Styles.RangeSlider.Win10}"
                      UpperValue="60">
    <Controls:RangeSlider.AutoToolTipRangeValuesTemplate>
        <DataTemplate DataType="Controls:RangeSliderAutoTooltipValues">
            <UniformGrid Columns="2" Rows="2">
                <TextBlock Text="From:" HorizontalAlignment="Right" />
                <TextBlock Text="{Binding LowerValue, StringFormat='{}{0:N2}'}" HorizontalAlignment="Right" />
                <TextBlock Text="To:" HorizontalAlignment="Right" />
                <TextBlock Text="{Binding UpperValue, StringFormat='{}{0:N2}'}" HorizontalAlignment="Right" />
            </UniformGrid>
        </DataTemplate>
    </Controls:RangeSlider.AutoToolTipRangeValuesTemplate>
</Controls:RangeSlider>

2019-01-27_15h21_22

Additional context

Original idea by this PR #2784 is from @Anapher

Closed Issues

Closes #2784

…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 added this to the 2.0.0 milestone Jan 27, 2019
@punker76 punker76 merged commit 343dbfd into develop Jan 27, 2019
@punker76 punker76 deleted the feature/GH-2784_DataTemplate_for_RangeSlider_AutoToolTip_Values branch January 27, 2019 15:51
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.

None yet

1 participant