Note that there are some explanatory texts on larger screens.

plurals
  1. POCondition Binding Attribute Not Working?
    text
    copied!<p>I've been struggling with this code for some time now and can't seem to find any complete answers to my question. I've created a small sample to illustrate the problem:</p> <pre><code>&lt;ListView &gt; &lt;ListView.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel Margin="0,0,20,0" IsItemsHost="True" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListView.ItemsPanel&gt; &lt;ListView.Items&gt; &lt;TextBlock&gt;Test1&lt;/TextBlock&gt; &lt;TextBlock&gt;Test2&lt;/TextBlock&gt; &lt;TextBlock&gt;Test3&lt;/TextBlock&gt; &lt;TextBlock&gt;Test4&lt;/TextBlock&gt; &lt;TextBlock&gt;Test5&lt;/TextBlock&gt; &lt;/ListView.Items&gt; &lt;ListView.ItemContainerStyle&gt; &lt;Style TargetType="{x:Type ListViewItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type ListViewItem}"&gt; &lt;Grid&gt; &lt;ContentPresenter/&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;MultiTrigger&gt; &lt;MultiTrigger.Conditions&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True" /&gt; &lt;Condition Property="IsSelected" Value="True"/&gt; &lt;/MultiTrigger.Conditions&gt; &lt;Setter Property="Visibility" Value="Collapsed"/&gt; &lt;/MultiTrigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ListView.ItemContainerStyle&gt; &lt;/ListView&gt; </code></pre> <p>According to the MultiTrigger settings, the selected item should reappear when the mouse is no longer over the selected item. This code, however, produces an InvalidOperationException with the message "Must have non-null value for 'Property'." If you remove the Condition that uses the "Binding" attribute the exception is not thrown. In the MSDN documentation it states that you must have either the Property or Binding attribute set. The above code functions like the Binding attribute is not set. In fact, in all my test cases, it doesn't matter what the Binding attribute is set to; the exception is still thrown. Any thoughts?</p>
 

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