title: Navigation Drawer stays open
body: <p>I'm working on a c# WPF program and i've a Navigation Drawer that should be closed when a checkBox is checked and opened when the checkbox is not checked</p>
  <p>Here is a Screenshot from the Navigation Drawer</p>
  <p><a href="https://i.stack.imgur.com/EpOOn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EpOOn.png" alt="[1]: https://i.stack.imgur.com/EpOOn.png" /></a></p>
  <p>I'm trying to do that with a DataTrigger.</p>
  <p>Here is the XAML Code:</p>
  <p>My Storyboards:</p>
  <pre><code>&lt;Window.Resources&gt;
          &lt;Storyboard x:Key=&quot;OpenMenu&quot;&gt;
              &lt;DoubleAnimation
                  Storyboard.TargetProperty=&quot;(Width)&quot;
                  From=&quot;70&quot;
                  To=&quot;350&quot;
                  Duration=&quot;0:0:0.5&quot; /&gt;
          &lt;/Storyboard&gt;
          &lt;Storyboard x:Key=&quot;CloseMenu&quot;&gt;
              &lt;DoubleAnimation
                  Storyboard.TargetProperty=&quot;(Width)&quot;
                  From=&quot;350&quot;
                  To=&quot;70&quot;
                  Duration=&quot;0:0:0.5&quot; /&gt;
          &lt;/Storyboard&gt;
      &lt;/Window.Resources&gt;
  </code></pre>
  <p>And the DataTrigger:</p>
  <pre><code>&lt;Grid.Style&gt;
                  &lt;Style TargetType=&quot;Grid&quot;&gt;
                      &lt;Setter Property=&quot;Width&quot; Value=&quot;350&quot; /&gt;
                      &lt;Style.Triggers&gt;
                          &lt;DataTrigger Binding=&quot;{Binding ElementName=CheckBox, Path=IsChecked}&quot; Value=&quot;False&quot;&gt;
                              &lt;DataTrigger.EnterActions&gt;
                                  &lt;BeginStoryboard Storyboard=&quot;{StaticResource CloseMenu}&quot; /&gt;
                              &lt;/DataTrigger.EnterActions&gt;
                          &lt;/DataTrigger&gt;
                          &lt;DataTrigger Binding=&quot;{Binding ElementName=CheckBox, Path=IsChecked}&quot; Value=&quot;True&quot;&gt;
                              &lt;DataTrigger.EnterActions&gt;
                                  &lt;BeginStoryboard Storyboard=&quot;{StaticResource OpenMenu}&quot; /&gt;
                              &lt;/DataTrigger.EnterActions&gt;
                          &lt;/DataTrigger&gt;
                      &lt;/Style.Triggers&gt;
                  &lt;/Style&gt;
              &lt;/Grid.Style&gt;
  </code></pre>
  <p>And the CheckBox</p>
  <pre><code>&lt;CheckBox Name=&quot;CheckBox&quot; /&gt;
  </code></pre>
  <p>The problem is that the Navigation Drawer stays open.
  It closes quickly and opens again when I check the CheckBox.</p>
  <p>Any ideas?</p>
  <p><strong>EDIT:</strong></p>
  <p>This is the code after BionicCode's answer:</p>
  <pre><code>&lt;Grid.Style&gt;
                  &lt;Style TargetType=&quot;Grid&quot;&gt;
                      &lt;Setter Property=&quot;Width&quot; Value=&quot;70&quot; /&gt;
                      &lt;Style.Triggers&gt;
                          &lt;DataTrigger Binding=&quot;{Binding ElementName=CheckBox, Path=IsChecked}&quot; Value=&quot;True&quot;&gt;
                              &lt;DataTrigger.EnterActions&gt;
                                  &lt;BeginStoryboard Storyboard=&quot;{StaticResource OpenMenu}&quot; /&gt;
                              &lt;/DataTrigger.EnterActions&gt;
                              &lt;DataTrigger.ExitActions&gt;
                                  &lt;BeginStoryboard Storyboard=&quot;{StaticResource CloseMenu}&quot; /&gt;
                              &lt;/DataTrigger.ExitActions&gt;
                          &lt;/DataTrigger&gt;
                      &lt;/Style.Triggers&gt;
                  &lt;/Style&gt;
              &lt;/Grid.Style&gt;
  </code></pre>