I had a bunch of errors of the following type System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element.
I was able to resolve most of those except the following two.
The first error is
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=WColor; DataItem=null; target element is 'SolidColorBrush' (HashCode=34289570); target property is 'Color' (type 'Color')
The XAML code for this error is below
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasWColor}" Value="True">
<Setter TargetName="HeaderIcon" Property="Fill">
<Setter.Value>
<SolidColorBrush Color="{Binding Path=WColor, Converter={StaticResource ColorToBrushConverter}}"/>
</Setter.Value>
</Setter>
</DataTrigger>
</ControlTemplate>
I was able to resolve a very similar error in another file of my application by using the converter ColorToBrushConverter.
The same converter doesn't work here though. Below is the code where this works.
<DataTemplate x:Key="GroupTemplate">
<StackPanel x:Name="Group" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border BorderThickness="0,2,0,3" BorderBrush="{DynamicResource TableBorderBrush}">
<Border BorderThickness="7,0,0,0" >
<Border.BorderBrush>
<SolidColorBrush Color="{Binding GroupColor, Converter={StaticResource ColorToBrushConverter}}"/>
</Border.BorderBrush>
</Border>
</Border>
</StackPanel>
<DataTemplate/>
The second error is
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=TranslateY; DataItem=null; target element is 'TranslateTransform' (HashCode=10383263); target property is 'Y' (type 'Double')
The code for this error is
<MultiDataTrigger.Setters>
<Setter Property="Visibility" Value="Visible"/>
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform x:Name="myTransform">
<TranslateTransform.X>
<MultiBinding Converter="{StaticResource OffsetConverter}">
<Binding Path="DisplayedX"/>
<Binding ElementName="LinesGrid" Path="ActualWidth"/>
<Binding Source="17"/>
</MultiBinding>
</TranslateTransform.X>
<TranslateTransform.Y>
<MultiBinding Converter="{StaticResource OffsetConverter}">
<Binding Path="TranslateY"/>
<Binding ElementName="PointsGrid" Path="ActualHeight"/>
<Binding Source="17"/>
<Binding Path="PointType"/>
</MultiBinding>
</TranslateTransform.Y>
</TranslateTransform>
</Setter.Value>
</Setter>
</MultiDataTrigger.Setters>
I have tried giving the TranslateTransform
an x:Name
property as suggested in this post but to no avail.
Any ideas on how to get rid of these errors?