Update tooltip from code

8 posts, 0 answers
  1. Christian
    Christian avatar
    5 posts
    Member since:
    Jan 2014

    Posted 03 Mar 2014 Link to this post

    Hi,

    I have a audio app with a slider which the user can slide to change the location in the audio.
    I want to use your tooltip for showing which minute and second they are sliding to.

    So i used: RadToolTipService.Open(Me, str)
    Where str is my text with the location.
    This code is firing in the slider-changed event.
    The problem is that the text isn't changing, it is the first text that I used when the first slider-changed event fired.

    I can call close before but then the tooltip will flicker and that isn't very nice.
    How can I update the text shown in the tooltip, from code?

    /Christian
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 07 Mar 2014 Link to this post

    Hello Christian,

    I suggest you use the RadToolTipService.Tooltip and RadToolTipService.ToolTipTemplate attached properties instead of the Open() method to specify what the tool tip is. Then, when you open the tool tip and then update it with different text, the template will refresh itself automatically.

    Please write again if you have other questions.

    Regards,
    Victor
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. DevCraft banner
  4. Christian
    Christian avatar
    5 posts
    Member since:
    Jan 2014

    Posted 20 Mar 2014 in reply to Victor Link to this post

    Hi Victor,

    I can't get it to show. Nothing happens. 
    I'm using a slider and want the tooltip to show when I move the slider.
    What am I doing wrong?
    This i my code:

    <Slider Grid.Row="0" Grid.ColumnSpan="2" Minimum="0" Maximum="100" Value="{Binding CurrentValue, ElementName=theSlider}" ValueChanged="Slider_ValueChanged" ManipulationCompleted="theSliderControl_ManipulationCompleted" ManipulationStarted="theSliderControl_ManipulationStarted"  VerticalAlignment="Top" Margin="0" Padding="0" Name="theSliderControl" telprim:RadToolTipService.ShowGesture="Hold"  telprim:RadToolTipService.ToolTip="{Binding ToolTip, ElementName=theSlider}" >
                <telprim:RadToolTipService.Template>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="Du flyttar till:" />
                            <TextBlock Text="{Binding Name}"/>
                            <TextBlock Text="{Binding Description}"/>
                        </StackPanel>
                    </DataTemplate>
                </telprim:RadToolTipService.Template>
            </Slider>


  5. Todor
    Admin
    Todor avatar
    778 posts

    Posted 25 Mar 2014 Link to this post

    Hi Christian,

    Probably there is an issue with the binding in your code.
    I have attached a sample to illustrate how you can get the ToolTip updated from code.

    I hope this information helps.

    Regards,
    Todor
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  6. Christian
    Christian avatar
    5 posts
    Member since:
    Jan 2014

    Posted 25 Mar 2014 in reply to Todor Link to this post

    Hi Todor,

    unfortunately your sample doesn't seem to work.
    Neither in emulator or on my device (Nokia Lumia 1020).
  7. Todor
    Admin
    Todor avatar
    778 posts

    Posted 25 Mar 2014 Link to this post

    Hello Christian,

    What happens? Did you manage to run/compile the solution? Did you see a tooltip after a hold gesture on the Slider? Did it update its content next time you made a hold gesture?

    I'm looking forward to your reply.

    Regards,
    Todor
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  8. Christian
    Christian avatar
    5 posts
    Member since:
    Jan 2014

    Posted 25 Mar 2014 in reply to Todor Link to this post

    Hi, it works. I just didn't hold my finger down/still for enough long time.
    Is it possible to change the time until it shows?
  9. Todor
    Admin
    Todor avatar
    778 posts

    Posted 27 Mar 2014 Link to this post

    Hello Christian,

    In the sample the gesture that is chosen to show the tooltip is Hold. If you want, you can change it to Tap through the ShowGesture attached property and the tooltip will show faster. However, we can't specify the exact time that is required to hold your finger in order to detect a Hold gesture.

    Regards,
    Todor
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top
DevCraft banner