tags:

views:

175

answers:

1

I'm trying to add a ToolTip to a Grid using a Style (as follows):

<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>

However, at runtime I get the following error:

Cannot add content of type 'System.Windows.Controls.ToolTip' to an object of type 'System.Object'. Error at object 'System.Windows.Controls.ToolTip' in markup file 'InnoFit;component/controls/fittingdetails.xaml' Line 24 Position 26.

What's wrong here?

+2  A: 

This post successfully answers a similar problem.

luvieere