title: Popup to appear on the bottom-right corner of its parent
body: <p>I'm trying to design a Popup which will appear on the bottom-right corner of its <code>PlacementTarget</code></p>
  
  <p>Let's admit that you set its <code>PlacementTarget</code> to a <code>Window</code>, well, the Popup will act as classic toaster notifications.</p>
  
  <p>Given the fact that WPF is not smart enough to provide us a "corner" solution, I'm trying to implement a new control, inheriting from <code>Popup</code> , which will place itself at the appropriate location.</p>
  
  <p>Here is my first idea: work on <code>Loaded</code> event to determine where should I place the Popup.
  Problem? I don't want to give any fixed dimensions to the popup, which is supposed to size itself according to the text displayed.</p>
  
  <p>However, I can't get the <code>ActualWidth</code> property when <code>Loaded</code> event is raised. 
  I can't have it either when <code>Opened</code> event is raised.</p>
  
  <p>Here is the draft code so far:</p>
  
  <pre><code>public class ExceptionPopup : Popup
  {
         public ExceptionPopup()
          {
              InitializeComponent();
              Loaded += new RoutedEventHandler(ExceptionPopup_Loaded);
          }
  
          void ExceptionPopup_Loaded(object sender, RoutedEventArgs e)
          {
              if (PlacementTarget != null)
              {
                  if (PlacementTarget is FrameworkElement)
                  {
                      parentWidth = (PlacementTarget as FrameworkElement).ActualWidth;
                      parentHeight = (PlacementTarget as FrameworkElement).ActualHeight;
                  }
              }
          }
  
          protected override void OnOpened(EventArgs e)
          {
              this.HorizontalOffset = parentWidth;
              this.VerticalOffset = parentHeight;
              base.OnOpened(e);
          }
  }
  </code></pre>
  
  <p>Is there any other event I could use to catch what I want here?
  I'd basically like to set <code>HorizontalOffset</code> to <code>parentWidth - ActualWidth/2</code> , same for height :)
  Any idea?</p>
  
  <p>Thanks!</p>