title: Why the trigger doesn't work after GridSplitter is dragged
body: <p>Due to project privacy protection, I can't paste the product code here. So I made a simple example to show the problem.</p>
  
  <p>I have a window like this:
  <a href="https://i.stack.imgur.com/wm1jJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wm1jJ.jpg" alt="enter image description here"></a></p>
  
  <p>When I click the Right button, I want the Right Column hide and the Left Column Stretch to full window:</p>
  
  <p><a href="https://i.stack.imgur.com/a3IB6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a3IB6.jpg" alt="enter image description here"></a></p>
  
  <p>Here is my Xaml:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition MinWidth="0"/&gt;
              &lt;ColumnDefinition Width="Auto"/&gt;
              &lt;ColumnDefinition x:Name="rightCol" MinWidth="0"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;StackPanel Grid.Column="0"&gt;
              &lt;Button Height="100" Content="Left" /&gt;
          &lt;/StackPanel&gt;
  
          &lt;GridSplitter Grid.Column="1" Width="10" VerticalAlignment="Stretch" HorizontalAlignment="Center"/&gt;
          &lt;StackPanel x:Name="right" Grid.Column="2" &gt;
              &lt;Button Height="100" Content="Right" Click="Button_Click" /&gt;
          &lt;/StackPanel&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>And here is my code-behind:</p>
  
  <pre><code>    public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
  
          }
  
          public override void OnApplyTemplate()
          {
              base.OnApplyTemplate();
              var b = new Binding("Visibility")
              {
                  Source = this.right
              };
  
              var style = new Style(typeof(ColumnDefinition))
              {
                  Setters = 
                  {
                      new Setter(ColumnDefinition.WidthProperty, new GridLength(300)),
                      new Setter(ColumnDefinition.MinWidthProperty, 0.0),
                  }
              };
  
              style.Triggers.Add(new DataTrigger()
              {
                  Binding = b,
                  Value = System.Windows.Visibility.Collapsed,
                  Setters = 
                      { 
                          new Setter(ColumnDefinition.WidthProperty, new GridLength(0)),
                          new Setter(ColumnDefinition.MaxWidthProperty, double.PositiveInfinity),
                          new Setter(ColumnDefinition.MinWidthProperty, 0.0),
                      }
              });
  
              this.rightCol.Style = style;
          }
  
          private void Button_Click(object sender, RoutedEventArgs e)
          {
              this.right.Visibility = System.Windows.Visibility.Collapsed;
          }
      }
  </code></pre>
  
  <p>When I run it and Click the Right button, it works fine. But <strong>if I drag the GridSplitter before I Click the Right button</strong>, the trigger doesn't work:
  <a href="https://i.stack.imgur.com/Sfz75.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sfz75.jpg" alt="enter image description here"></a></p>
  
  <p>Why this happened?</p>
  
  <p>Note:
  If I use below code, it can work.</p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
  {
      this.right.Visibility = System.Windows.Visibility.Collapsed;
      this.rightCol.Width = new GridLength(0);
  }
  </code></pre>
  
  <p>But is there any way to use trigger?</p>