title: Binding to an expression
body: <p>I have an onscreen numeric keypad to type a PIN. What I want to do is disable the buttons when four digits of PIN are entered. I can certainly do this with code pretty easily, but it seems to me to be the sort of thing that should be done with binding.</p>
  
  <p>Something like:</p>
  
  <pre><code>&lt;Button Style="Whatever" IsEnabled="{Binding ElementName=PinBox ???}"/&gt;
  </code></pre>
  
  <p>It seems there isn't a way to do that (which to be honest seems rather primitive to me.) So I considered the alternative, which is a plain property on the underlying Window class. But I'm not sure how to bind to it. Do I need to specify the class itself as its own data context, or do I need to extract the PIN string into a View Model?</p>
  
  <p>And subsequently, how do I get the plain property to update the GUI?</p>
  
  <p>I suppose I could defined a view model class and have a dependency property called "ButtonsEnabled" but it seems kind of heavyweight for such a simple problem.</p>
  
  <p>Let me know if I am missing something.</p>