Cannot resolve symbol in CellTemplate binding

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Cannot resolve symbol in CellTemplate binding



I have a ListView control ItemsSource bound to Producers property and it works well. But when I try to add some DataTriggers I am getting Cannot resolve symbol VS warning.
Code works but I want to get rid of warning by explicitly specifying binding source.


Producers


Cannot resolve symbol



I tried to use RelativeSource but found that CellTemplate can not use relative source as it is not part of VisualTree.


<ListView ItemsSource="{Binding Producers, ElementName=This}">
<ListView.View>
<GridView>
<GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"></GridViewColumn>
<GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}"></GridViewColumn>
<GridViewColumn Header="Up">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Up}" Value="True">
<Setter Property="Foreground" Value="Green"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Up}" Value="False">
<Setter Property="Foreground" Value="Red"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>



This element is defined as:


This


<Window x:Class="Helper.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Helper"
mc:Ignorable="d"
Title="MainWindow" Height="900.731" Width="889.344"
x:Name="This">
<Grid>
...
</Grid>
</Window>



Can someone help?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived