From c4f935a2c53429c814c318f33790f478281a0224 Mon Sep 17 00:00:00 2001 From: batzen Date: Fri, 20 Feb 2015 19:12:21 +0100 Subject: [PATCH] Removing custom popup placement from combobox as it was not needed --- Fluent/Controls/ComboBox.cs | 52 +++++-------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/Fluent/Controls/ComboBox.cs b/Fluent/Controls/ComboBox.cs index 657b1d3af..4f5d29a81 100644 --- a/Fluent/Controls/ComboBox.cs +++ b/Fluent/Controls/ComboBox.cs @@ -596,16 +596,9 @@ public bool CanAddToQuickAccessToolBar /// public override void OnApplyTemplate() { - if (popup != null) popup.CustomPopupPlacementCallback -= CustomPopupPlacementMethod; - popup = GetTemplateChild("PART_Popup") as Popup; - if (popup != null) - { - popup.Placement = PlacementMode.Custom; - popup.CustomPopupPlacementCallback += CustomPopupPlacementMethod; - } - + this.popup = this.GetTemplateChild("PART_Popup") as Popup; - editableTextBox = GetTemplateChild("PART_EditableTextBox") as System.Windows.Controls.TextBox; + this.editableTextBox = this.GetTemplateChild("PART_EditableTextBox") as System.Windows.Controls.TextBox; if (resizeVerticalThumb != null) { @@ -959,14 +952,14 @@ private void SetDragHeight(DragDeltaEventArgs e) var delta = this.PointToScreen(new Point()).Y - dropDownBorder.ActualHeight - e.VerticalChange - monitorTop; if (delta > 0) { - scrollViewer.Height = Math.Max(0, + scrollViewer.Height = Math.Max(0, Math.Min(Math.Max(galleryPanel.GetItemSize().Height, scrollViewer.Height + e.VerticalChange), MaxDropDownHeight)); } else { delta = this.PointToScreen(new Point()).Y - dropDownBorder.ActualHeight - monitorTop; - scrollViewer.Height = Math.Max(0, + scrollViewer.Height = Math.Max(0, Math.Min(Math.Max(galleryPanel.GetItemSize().Height, scrollViewer.Height + delta), MaxDropDownHeight)); } @@ -978,53 +971,20 @@ private void SetDragHeight(DragDeltaEventArgs e) var delta = monitorBottom - this.PointToScreen(new Point()).Y - ActualHeight - popupChild.ActualHeight - e.VerticalChange; if (delta > 0) { - scrollViewer.Height = Math.Max(0, + scrollViewer.Height = Math.Max(0, Math.Min(Math.Max(galleryPanel.GetItemSize().Height, scrollViewer.Height + e.VerticalChange), MaxDropDownHeight)); } else { delta = monitorBottom - this.PointToScreen(new Point()).Y - ActualHeight - popupChild.ActualHeight; - scrollViewer.Height = Math.Max(0, + scrollViewer.Height = Math.Max(0, Math.Min(Math.Max(galleryPanel.GetItemSize().Height, scrollViewer.Height + delta), MaxDropDownHeight)); } } } - /// - /// Implements custom placement for ribbon popup - /// - /// - /// - /// - /// - CustomPopupPlacement[] CustomPopupPlacementMethod(Size popupsize, Size targetsize, Point offset) - { - if (popup != null) - { - Rect monitorRect = RibbonControl.GetControlMonitor(this); - Point pos = PointToScreen(new Point()); - - if (ShowPopupOnTop) - { - return new CustomPopupPlacement[] - { - new CustomPopupPlacement(new Point(0, -dropDownBorder.ActualHeight), PopupPrimaryAxis.Horizontal), - }; - } - else - { - - return new CustomPopupPlacement[] - { - new CustomPopupPlacement(new Point(0, ActualHeight), PopupPrimaryAxis.Horizontal), - }; - } - } - return null; - } - #endregion } } \ No newline at end of file