C# 无法在样式中添加工具提示
我正在尝试使用C# 无法在样式中添加工具提示,c#,wpf,xaml,styles,tooltip,C#,Wpf,Xaml,Styles,Tooltip,我正在尝试使用样式将工具提示添加到网格(如下所示): 但是,在运行时,我得到以下错误: 无法添加类型为的内容 “System.Windows.Controls.ToolTip”以 类型为“System.object”的对象。 对象错误 中的“System.Windows.Controls.ToolTip” 标记文件 “InnoFit;组件/控件/配件详细信息。xaml' 第24行第26位 这里出了什么问题?post成功地回答了类似的问题。post成功地回答了类似的问题。 <Resour
样式将工具提示
添加到网格
(如下所示):
但是,在运行时,我得到以下错误:
无法添加类型为的内容
“System.Windows.Controls.ToolTip”以
类型为“System.object”的对象。
对象错误
中的“System.Windows.Controls.ToolTip”
标记文件
“InnoFit;组件/控件/配件详细信息。xaml'
第24行第26位
这里出了什么问题?post成功地回答了类似的问题。post成功地回答了类似的问题。
<ResourceDictionary>
<Style x:Key="ToolTipGrid" TargetType="{x:Type Grid}" x:Shared="False">
<Setter Property="ToolTip">
<Setter.Value>
<ToolTip>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding ElementName=this, Path=Right}"
ItemTemplate="{StaticResource KeyValueDataTemplate}" />
<ItemsControl ItemsSource="{Binding ElementName=this, Path=Left}"
ItemTemplate="{StaticResource KeyValueDataTemplate}" />
</Grid>
</ToolTip>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>