title: Silverlight ChildWindow Size binding
body: <p>I am trying to bind ChildWindow <code>Height</code> property to my viewmodel property , but I think it only reads VM value on first load and doesn't change size when VM changes &amp; notifies about the change. In debugger I see that it goes into Height getter once, further notifications don't change ChildWindow size..</p>
  
  <p>I think it should be bindable so I am wondering whether some issue exists here or I am doing some mistake?</p>
  
  <p>Sounds like one time binding, but its oneway..</p>
  
  <pre><code>Height="{Binding WindowHeight,Mode=OneWay}" 
  </code></pre>
  
  <p>Further investigation shows that when we change binding to <code>Mode=TwoWay</code> and add an empty setter it begins to behave as expected. But that doesn't explain the reason why OneWay binding doesn't work. Also value that is passed to setter is equal to my whole application height, not just childwindow that is obviously supposed to be smaller.</p>
  
  <p>The most strange thing with this whole situation is the following:</p>
  
  <blockquote>
    <p>Also this value is passed to setter
    <strong>4</strong> consecutive times everytime after a getter is called (see
    <code>count++</code> that is used to count that).</p>
  </blockquote>
  
  <p>It is fired before dialog is actually shown, and it always goes in sequence <code>get,set,set,set,set</code></p>
  
  <p>Code for view model is super simple. Nowhere in code anyone is using ChildWindow Height, its only set in its xaml binding as shown above.</p>
  
  <pre><code>    private int count = 0;
      public int WindowHeight
      {
          get { return IsDefaultMode? DEFAULT_HEIGHT : SPECIAL_HEIGHT; }
          set {count++; }
      }
  </code></pre>
  
  <p>My inheriting Childwindow class contains like 5 strings of text none of which affect Height in any way.</p>
  
  <p>Notification about WindowHeight is not fired by WindowHeight property (as seen in code) , its fired by Mode property. Couldve been a converter around mode but its currently implemented this way cause I am not sure a special converter with a couple of magic values for this situation is a better approach.</p>
  
  <p>oks . mode setter code:</p>
  
  <pre><code>public bool IsSpecialMode
          {
              get { return m_IsSpecialMode; }
              set
              {
                  if (m_IsSpecialMode!= value) 
                  {
                      m_IsSpecialMode= value;
                      NotifyPropertyChanged("IsSpecialMode");
                      NotifyPropertyChanged("WindowHeight");
                  }
              }
          }
  </code></pre>