這是我編寫Silverlight XAML時經常出現的問題。在這種情況下,我創建了一個附帶ToolTip的用戶控件VerticalTabStop(附帶代碼)。我實例化一對夫婦的我的usercontrols的,然後我得到的調試窗口和以下錯誤:Silverlight:「該名稱已存在於樹中」
Line:52
Error: Unhandled Error in Silverlight 2 Application
Code: 2028
Category: ParserError
Message: The name already exists in the tree: AltLabel.
File:
Line: 0
Position: 0
我得到一個可怕的很多這些消息,因爲我懸停我的鼠標按鈕。任何建議,我在做什麼錯在這裏?
乾杯
Nik
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="SLEntityPresenterWebPart.VerticalTabStop"
d:DesignWidth="20" d:DesignHeight="27">
<Grid x:Name="LayoutRoot">
<StackPanel>
<Canvas x:Name="TabStopCanvas" Height="27" Width="20">
<ToolTipService.ToolTip>
<TextBlock x:Name="AltLabel" Text="Substitute me"/>
</ToolTipService.ToolTip>
<Image x:Name="IconImg" Canvas.Left="7" Canvas.Top="9" Width="26" Height="26" Source="Contact.png" Canvas.ZIndex="5" Margin="0,-9,0,0" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.85" ScaleY="0.85"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform X="0"/>
</TransformGroup>
</Image.RenderTransform>
</Image>
<Image Source="stop.png" Margin="3,0,0,0"/>
</Canvas>
</StackPanel>
</Grid>
</UserControl>
非常感謝,我不知道這是Silverlight中的一個錯誤,你的解決方案做到了這一點:-) – 2009-03-05 07:42:40