Exemple #1
0
 public Monitor(UIElement element)
 {
     this.Element                = element;
     this.HwndSource             = ScreenLocation.FindTopLevelHwndSource(element);
     this.Element.LayoutUpdated += new EventHandler(this.OnLayoutUpdated);
     PresentationSource.AddSourceChangedHandler((IInputElement)element, new SourceChangedEventHandler(this.OnPresentationSourceChanged));
 }
Exemple #2
0
 private void OnPresentationSourceChanged(object sender, SourceChangedEventArgs args)
 {
     this.HwndSource = ScreenLocation.FindTopLevelHwndSource((UIElement)sender);
     this.TryUpdateLocation();
 }