private void RootContainer_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (_locatorTcs != null) { var rootContainer = (FrameworkElement)sender; var pos = e.GetPosition(rootContainer); var pixelSize = WpfUnitsConversion.ToPixels(rootContainer as Visual, pos); var result = LocatorResult.CreateClicked((int)pixelSize.X, (int)pixelSize.Y); EndLocatorMode(result); } }
private void PlotWindowPane_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e) { var unadjustedPixelSize = WpfUnitsConversion.ToPixels(Content as Visual, e.NewSize); // If the window gets below a certain minimum size, plot to the minimum size // and user will be able to use scrollbars to see the whole thing int pixelWidth = Math.Max((int)unadjustedPixelSize.Width, MinPixelWidth); int pixelHeight = Math.Max((int)unadjustedPixelSize.Height, MinPixelHeight); // Throttle resize requests since we get a lot of size changed events when the tool window is undocked IdleTimeAction.Cancel(this); IdleTimeAction.Create(() => { PlotContentProvider.DoNotWait(_plotHistory.PlotContentProvider.ResizePlotAsync(pixelWidth, pixelHeight)); }, 100, this); }