title: How to use this AdaptiveTrigger in UWP App
body: <p>I am writing an <strong>UWP Application</strong>.</p>
  
  <p>I added <strong>SplitView</strong> (for hamburger purposes) to page.</p>
  
  <p>In <strong>SplitView Pane</strong>, I have two Items:</p>
  
  <ul>
  <li>SellButtonGrid </li>
  <li>SellButtonGridAlternate</li>
  </ul>
  
  <p>Visibility of above two items depend on two <strong>conditions</strong>: </p>
  
  <ul>
  <li>Minimum 520 Windows Height</li>
  <li>and SplitViewPane opened or closed.</li>
  </ul>
  
  <p>That means 4 cases :</p>
  
  <blockquote>
    <ol>
    <li>Windows height lesser than 520 and splitviewpane closed</li>
    <li><p>Windows height lesser than 520 and splitviewpane open</p></li>
    <li><p>Windows height larger than 520 and splitviewpane closed</p></li>
    <li>Windows height larger than 520 and splitviewpane open</li>
    </ol>
  </blockquote>
  
  <p><strong>For splitview open or close I use:</strong>  </p>
  
  <pre><code>&lt;VisualState x:Name="SplitViewOpen"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen}" /&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Visible" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Collapsed" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  &lt;VisualState x:Name="SplitViewClosed"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen, Converter={StaticResource BooleanNegationConverter}}" /&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Collapsed" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Visible" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  </code></pre>
  
  <p><strong>For detecting height below or above 520 I use:</strong></p>
  
  <pre><code>&lt;VisualState x:Name="SmallHeight"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;AdaptiveTrigger MinWindowHeight="0" /&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Collapsed" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Visible" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  &lt;VisualState x:Name="LargeHeight"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;AdaptiveTrigger MinWindowHeight="520" /&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Visible" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Collapsed" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  </code></pre>
  
  <p>But, the results are not what I expected.
  How to merge these visual states??</p>
  
  <p><strong>I tried using:</strong>
  <a href="http://dotnetbyexample.blogspot.in/2016/02/an-adaptivetrigger-that-works-with.html" rel="nofollow">http://dotnetbyexample.blogspot.in/2016/02/an-adaptivetrigger-that-works-with.html</a></p>
  
  <p>I used above solution, so:
  <strong>My reworked code:</strong></p>
  
  <pre><code>xmlns:Utils="using:DellApp.Utils"
  xmlns:converters="using:DellApp.Converters"
  xmlns:windowsStateTriggers="using:WindowsStateTriggers"
  </code></pre>
  
  <p>Newly created states:</p>
  
  <pre><code>  &lt;VisualState.StateTriggers&gt;
    &lt;windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;Utils:AdaptiveTrigger MinWindowHeight="520" MaxWindowHeight="18000" /&gt;
  
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen,
    Converter={StaticResource BooleanNegationConverter}}" /&gt;
    &lt;/windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Collapsed" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Visible" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  
  &lt;VisualState x:Name="SplitViewCollapsed_SmallHeight"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;Utils:AdaptiveTrigger MaxWindowHeight="519"
    MinWindowHeight="0" /&gt;
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen,
    Converter={StaticResource BooleanNegationConverter}}" /&gt;
    &lt;/windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Collapsed" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Visible" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  
  &lt;VisualState x:Name="SplitViewOpen_SmallHeight"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;Utils:AdaptiveTrigger MaxWindowHeight="519"
    MinWindowHeight="0" /&gt;
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen}" /&gt;
    &lt;/windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Collapsed" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Visible" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  
  &lt;VisualState x:Name="SplitViewOpen_LargeHeight"&gt;
    &lt;VisualState.StateTriggers&gt;
    &lt;windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;Utils:AdaptiveTrigger MinWindowHeight="520" MaxWindowHeight="18000"/&gt;
    &lt;StateTrigger IsActive="{Binding ElementName=LayoutSplitView,
    Path=IsPaneOpen}" /&gt;
    &lt;/windowsStateTriggers:CompositeStateTrigger&gt;
    &lt;/VisualState.StateTriggers&gt;
    &lt;VisualState.Setters&gt;
    &lt;Setter Target="SellButtonGrid.Visibility" Value="Visible" /&gt;
    &lt;Setter Target="SellButtonGridAlternate.Visibility" Value="Collapsed" /&gt;
    &lt;/VisualState.Setters&gt;
  &lt;/VisualState&gt;
  </code></pre>
  
  <p>So, what I did was, I added <a href="https://github.com/dotMorten/WindowsStateTriggers" rel="nofollow">CompositeStateTrigger from WindowsStateTriggers</a> but I am not able to trigger it.</p>