Note that there are some explanatory texts on larger screens.

plurals
  1. POBindingExpression path error: property not found on 'object'
    text
    copied!<p>I've been searching for hours on this error that appears in the output window. I'm pretty new to bindings in WPF, so I'm sure there's something I'm missing.</p> <p>Full text of the error (there is one for each binding path, all similar to this one):</p> <blockquote> <p>System.Windows.Data Error: 39 : BindingExpression path error: 'TestItem' property not found on 'object' ''String' (HashCode=-842352750)'. BindingExpression:Path=TestItem; DataItem='String' (HashCode=-842352750); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')</p> </blockquote> <p><strong>EDIT:</strong> Everything seems to work as it should, but I get these errors in the output window.</p> <p>XAML:</p> <pre><code>&lt;UserControl&gt; &lt;UserControl.Resources&gt; &lt;c:MyData x:Key="myDataSource"/&gt; &lt;DataTemplate x:Key="image"&gt; &lt;Image x:Name="TheImage" /&gt; &lt;DataTemplate.Triggers&gt; &lt;DataTrigger Binding="{Binding Path=PassFail}" Value="PASS"&gt; &lt;Setter TargetName="TheImage" Property="Source" Value="Images/accept.png" /&gt; &lt;/DataTrigger&gt; &lt;DataTrigger Binding="{Binding Path=PassFail}" Value="FAIL"&gt; &lt;Setter TargetName="TheImage" Property="Source" Value="Images/delete.png" /&gt; &lt;/DataTrigger&gt; &lt;DataTrigger Binding="{Binding Path=PassFail}" Value="WARNING"&gt; &lt;Setter TargetName="TheImage" Property="Source" Value="Images/warning.png" /&gt; &lt;/DataTrigger&gt; &lt;/DataTemplate.Triggers&gt; &lt;/DataTemplate&gt; &lt;Storyboard x:Key="OnMouseLeftButtonDown1"/&gt; &lt;/UserControl.Resources&gt; &lt;UserControl.DataContext&gt; &lt;Binding Source="{StaticResource myDataSource}"/&gt; &lt;/UserControl.DataContext&gt; &lt;ListView Margin="0,94,-4,-7" x:Name="lsvwOutput" ItemsSource="{Binding Source={StaticResource myDataSource}}" MouseUp="lsvwOutput_MouseUp" FontFamily="Verdana"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="Test Item" Width="300" DisplayMemberBinding="{Binding Path=TestItem}" /&gt; &lt;GridViewColumn Header="Information" Width="0" DisplayMemberBinding="{Binding Path=Information}"/&gt; &lt;GridViewColumn Header="Result" Width="0" DisplayMemberBinding="{Binding Path=PassFail}"/&gt; &lt;GridViewColumn Header="Result" CellTemplate="{StaticResource image}" /&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView &lt;/UserControl&gt; </code></pre> <p>Code behind:</p> <pre><code>public class MyData : INotifyPropertyChanged { private string _testitem = ""; private string _information = ""; private string _passfail = ""; public string TestItem { get { return _testitem; } set { _testitem = value; OnPropertyChanged("TestItem"); } } public string Information { get { return _information; } set { _information = value; OnPropertyChanged("Information"); } } public string PassFail { get { return _passfail; } set { _passfail = value; OnPropertyChanged("PassFail"); } } public string Text { get; set; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload