1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
4
using System.Windows.Controls;
5
using System.Windows.Input;
6
using System.Windows.Controls.Primitives;
7
using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common;
9
using System.Windows.Automation.Peers;
10
using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers;
12
namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls
14
public class Expander : System.Windows.Controls.Expander
16
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
18
base.OnPreviewMouseLeftButtonDown(e);
19
if (VisualTreeHelperUtil.GetControlAscendant<TextBox>(e.OriginalSource) == null || VisualTreeHelperUtil.GetControlAscendant<EditableTextBlock>(e.OriginalSource) == null)
21
if (!(e.OriginalSource is FrameworkElement))
24
FrameworkElement control = (FrameworkElement)e.OriginalSource;
25
while ((control = VisualTreeHelperUtil.GetControlAscendant<Grid>(control)) != null)
26
if (control.Name == "grdHeader")
34
protected virtual void ClickOnTheHeader()
36
DesignerCanvas designerCanvas = VisualHelper.GetVisualParent<DesignerCanvas>(this);
38
if (designerCanvas != null)
39
designerCanvas.Container.Selection = this.DataContext;