private void InitializeReactiveEvents() { var scheduler = new ControlScheduler(this); var selectionDrag = (from mouseDown in MouseDown where !overlayChannels && mouseDown.Button == MouseButtons.Left && MasterPane.FindChartRect(mouseDown.Location) == null let startRect = (Rectangle?)GetNormalizedRectangle(MasterPane.Rect, mouseDown.Location, mouseDown.Location) let previousSelection = MasterPane.PaneList.Select(pane => pane.Border.IsVisible).ToArray() select Observable.Return(startRect).Concat( (from mouseMove in MouseMove.TakeUntil(MouseUp) .Sample(SelectionRefreshInterval, scheduler) select(Rectangle?) GetNormalizedRectangle(MasterPane.Rect, mouseDown.Location, mouseMove.Location)) .Concat(Observable.Return <Rectangle?>(null))) .Select(rect => new { previousSelection, rect })) .Merge(); selectionNotifications = selectionDrag.Subscribe(xs => ProcessRubberBand(xs.previousSelection, xs.rect)); }