문제

I am c# silverlight(5) beginner and not a bit know about how to make tool tip. In fact i couldnt find any option in toolbox for tool tip.

What i have to do is to show a tooltip when mouse hover a button. Suppose if i have button like this :

<Button Content="{Binding Path=Id}"
        Command="{Binding DataContext.ShowPopupCommand,
                   RelativeSource={RelativeSource AncestorType=data:DataGrid}}"/>

Now how to create a ToolTip on this button in ViewModel.cs class ?

Could someone please give me guidance on how to create ToolTip in c# silverlight application using MVVM approach. Any piece of code for help is really appreciated. Would be a great help. Thanks.

도움이 되었습니까?

해결책

<Button
    ToolTipService.ToolTip="ToolTip based on the mouse."
    ToolTipService.Placement="Mouse"/>

If you need to display any FrameworkElements (and not just text) you can set the tooltip like this:

<Button>
    <ToolTipService.ToolTip>
        <Border Background="Pink">
            <StackPanel>
                <Image .../>
                <TextBlock .../>
            </StackPanel>
        </Border>
    </ToolTipService.ToolTip>
</Button>

다른 팁

Try this

<Button Content="{Binding Path=Id}"
        Command="{Binding DataContext.ShowPopupCommand,
            RelativeSource={RelativeSource AncestorType=data:DataGrid}}"
        ToolTip="{Binding SomeProperty}"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top