Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiTrigger: Combined DataTrigger and PropertyTrigger not working
    text
    copied!<p>I have a problem where I need to combine a <code>DataTrigger</code> and a <code>PropertyTrigger</code> into a <code>MultiDataTrigger</code> to show an <code>Image</code> in a <code>GridViewColumn</code> (combined with a <code>TreeView</code>, it's a custom control I'm using). I experimented and searched some thins on the internet and this is how far I've come:</p> <pre><code> &lt;Image Width="16" Height="16" Stretch="UniformToFill"&gt; &lt;Image.Style&gt; &lt;Style TargetType="{x:Type Image}"&gt; &lt;Setter Property="Source" Value="{Binding ScorecardNiveau, Converter={StaticResource ScorecardNiveauToImageConverter}}" /&gt; &lt;Style.Triggers&gt; &lt;MultiDataTrigger&gt; &lt;MultiDataTrigger.Conditions&gt; &lt;Condition Binding="{Binding WpfSettings.IsExpanded}" Value="True" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Source}" Value="/folder_closed.png" /&gt; &lt;/MultiDataTrigger.Conditions&gt; &lt;Setter Property="Source" Value="/folder_open.png" /&gt; &lt;/MultiDataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Image.Style&gt; &lt;/Image&gt; </code></pre> <p>Now, initially, the <code>Image</code> can have two images, according to the <code>Converter</code>. Either the folder_open, or another one (not important now). Now what I want is: when the TreeViewNode is expanded (<code>WpfSetting.IsExpanded = true</code>) and when the Image Source is folder_closed, I want the Image to get the folder_open image. I think I am close with the above code, but it's not really working. The <code>Image</code> isn't changing at all when I open a <code>TreeViewNode</code>.</p> <p>I think I am doing something wrong with the Condition on the <code>RelativeSource=Self</code>, but I am not sure.</p> <p>Anyone who can help me please? Thanks in advance.</p> <p>Of course, more information/code can be provided if needed.</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