Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在样式中添加工具提示_C#_Wpf_Xaml_Styles_Tooltip - Fatal编程技术网

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>