Cannot add style hint

I am trying to add ToolTip

in Grid

using 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, I get the following error at runtime:

Unable to add content of type 'System.Windows.Controls.ToolTip' for object of type 'System.Object'. Error in object 'System.Windows.Controls.ToolTip' in markup file 'InnoFit; component / control / fittingdetails.xaml 'Line 24 Position 26.

What's wrong here?

+2


source to share





All Articles