0

I need to use the ToolTip on a label inside a xaml

<Page x:Class="xxx.xxx"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
          mc:Ignorable="d" 
          d:DesignHeight="464" d:DesignWidth="628"
        Title="ManagementDetails" Loaded="Page_Loaded">

        <Grid>  
            <Label Margin="0,360,376,91" >
                <ToolTipService.ToolTip>
                      <ToolTip Content="Turtle" />         
                </ToolTipService.ToolTip>
            </Label> 
         </Grid>
    </Page>

this xaml file is used to be a child inside a frame contained in another xaml file

<Window x:Class="xxx.xxxxxx"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ViewProject" Height="626" Width="810" >
    <Grid  Height="600" Width="800">
        <Frame Margin="172,136,0,0" Name="frame1" />
    </Grid>
</Window>

i embedded the page xaml file inside the frame using

 MyClass myClass= new MyClass();
frame1.Navigate(myClass);

if i moved the label with the ToolTip from the page xaml file to the window xaml file the ToolTip work but when use it inside the page xaml file it doesn't work.

what is missing here to make it work inside the page xaml file

4

3 回答 3

0

你为什么要这样?!?

只需执行以下操作:

<Label Name="Some_Label" ToolTip="Turtle"> Fun with labels ...</Label>

完毕。应该在另一个内部或单独工作。

于 2013-10-29T23:49:13.457 回答
0

感谢大家的所有回答,这似乎是我的错,我感到很惭愧,我在同一页面上有重复的 xaml 文件,我正在编辑一个并查看另一个。很抱歉给您带来不便,再次感谢您的帮助。

于 2013-11-09T22:38:40.120 回答
0

使用工具提示控件:

该类ToolTipService必须与ToolTip控件一起使用,以便向我们的控件显示工具提示。对于示例,我将使用图像控件,但以下内容可以应用于每个控件。这是代码:

 <Image Source="GiantSeaTurtle.jpg" Width="400" Height="300">
      <ToolTipService.ToolTip>
        <ToolTip Content="Turtle"></ToolTip>
      </ToolTipService.ToolTip>
    </Image>
于 2013-10-30T03:49:13.837 回答