This is a migrated thread and some comments may be shown as answers.

Use style Bind tooltips

2 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
xu
Top achievements
Rank 1
xu asked on 24 Mar 2012, 04:34 AM

Hi,

I extended the RoutedUICommand class, added a ToolTip property to keep tooltip string for the command.

Then I want to use a style like below to bind tooltips on tool buttons,  but  finally it's  getting an error.

<Setter Property="ToolTipService.ToolTip" >
    <Setter.Value>
        <ToolTip>
            <ToolTip.ContentTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Command.ToolTip,RelativeSource={RelativeSource AncestorType=telerik:RadButton}}"/>
                </DataTemplate>
            </ToolTip.ContentTemplate>
        </ToolTip>
    </Setter.Value>
</Setter>
so how can I complete this mission, or if there is any other similar solutions?

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 28 Mar 2012, 12:56 PM
Hello Xu,

From the code snippet you sent I cannot tell from which control's style it is. But I attached a sample project demonstrating how to implement your requirement. Please let me know if it works for you or if I'm missing something.

Greetings,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
xu
Top achievements
Rank 1
answered on 30 Mar 2012, 03:46 AM
Yes, it works, thank you, Tina!
Tags
General Discussions
Asked by
xu
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
xu
Top achievements
Rank 1
Share this question
or