title: Anchor WPF control to the right
body: <p>This has to be fairly simple but my search is heavily disturbed by people trying to stretch a control (using Anchor.Left | Anchor.Right previously in Winforms). </p>
  
  <p>That's unrelated, I just want to anchor a control to the right.</p>
  
  <p>What I have is this:</p>
  
  <pre><code>|--------|
  |        |
  |  Foobar|
  |--------|
  </code></pre>
  
  <p>I can do that using HorizontalAlignment, a grid or a number of other ways. But it breaks if I resize the control.</p>
  
  <p>I want:</p>
  
  <pre><code>|----|
  |    |
  |obar|
  |----|
  </code></pre>
  
  <p>(that is - anchor on the right.. Don't touch that distance to the edge. Move the left side out of view)</p>
  
  <p>Instead I get this:</p>
  
  <pre><code>|----|
  |    |
  |Foob|
  |----|
  </code></pre>
  
  <p>(the left side of my content won't move out of view).</p>
  
  <p>I'm sure there's an easy solution to this, but so far I cannot convince WPF that it should damage/cut off the left side of my controls, no matter what.</p>
  
  <hr>
  
  <p>Okay, I was cheating and made it too simple I guess. What I really have is a list of rectangles (here represented by an X):</p>
  
  <pre><code>|---------|
  |     XXXX|
  |---------|
  </code></pre>
  
  <p>This is an ItemsControl with a StackPanel inside, containing (more or less only) Rectangles. The expectation stays the same though: Anchor the whole thing to the right, damage/scroll out the left side only when I resize.</p>