Mercurial > silverbladetech
diff SilverlightGlimpse/FloatableWindow/FloatableWindow.cs @ 69:a0bcd783e612
Latest work
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Mon, 23 Apr 2012 11:06:10 +0100 |
parents | 810116cd6b8e |
children |
line wrap: on
line diff
--- a/SilverlightGlimpse/FloatableWindow/FloatableWindow.cs Mon Apr 23 11:05:11 2012 +0100 +++ b/SilverlightGlimpse/FloatableWindow/FloatableWindow.cs Mon Apr 23 11:06:10 2012 +0100 @@ -25,7 +25,6 @@ [TemplatePart(Name = PART_ContentRoot, Type = typeof(FrameworkElement))] [TemplatePart(Name = PART_Overlay, Type = typeof(Panel))] [TemplatePart(Name = PART_Root, Type = typeof(FrameworkElement))] - [TemplatePart(Name = PART_Resizer, Type = typeof(FrameworkElement))] [TemplateVisualState(Name = VSMSTATE_StateClosed, GroupName = VSMGROUP_Window)] [TemplateVisualState(Name = VSMSTATE_StateOpen, GroupName = VSMGROUP_Window)] public class FloatableWindow : ContentControl @@ -38,11 +37,6 @@ private const string PART_Chrome = "Chrome"; /// <summary> - /// The name of the Resizer template part. - /// </summary> - private const string PART_Resizer = "Resizer"; - - /// <summary> /// The name of the CloseButton template part. /// </summary> private const string PART_CloseButton = "CloseButton"; @@ -414,7 +408,6 @@ { this.DefaultStyleKey = typeof(FloatableWindow); this.InteractionState = WindowInteractionState.NotResponding; - this.ResizeMode = ResizeMode.CanResize; } #endregion Constructors @@ -437,10 +430,11 @@ #region Properties + private Panel _parentLayoutRoot; public Panel ParentLayoutRoot { - get; - set; + get { return _parentLayoutRoot; } + set { _parentLayoutRoot = value; } } /// <summary> @@ -572,12 +566,6 @@ private set; } - public ResizeMode ResizeMode - { - get; - set; - } - #endregion Properties #region Static Methods @@ -979,34 +967,6 @@ } /// <summary> - /// Executed when the ContentPresenter size changes. - /// </summary> - /// <param name="sender">Content Presenter object.</param> - /// <param name="e">SizeChanged event args.</param> - private void ContentPresenter_SizeChanged(object sender, SizeChangedEventArgs e) - { - // timheuer: not sure really why this is here? - //if (this.ContentRoot != null && Application.Current != null && Application.Current.RootVisual != null && _isOpen) - //{ - // GeneralTransform gt = this.ContentRoot.TransformToVisual(Application.Current.RootVisual); - - // if (gt != null) - // { - // Point p = gt.Transform(new Point(0, 0)); - - // double x = this._windowPosition.X - p.X; - // double y = this._windowPosition.Y - p.Y; - // UpdateContentRootTransform(x, y); - // } - //} - - //RectangleGeometry rg = new RectangleGeometry(); - //rg.Rect = new Rect(0, 0, this._contentPresenter.ActualWidth, this._contentPresenter.ActualHeight); - //this._contentPresenter.Clip = rg; - //this.UpdatePosition(); - } - - /// <summary> /// Finds the X coordinate of a point that is defined by a line. /// </summary> /// <param name="p1">Starting point of the line.</param> @@ -1081,7 +1041,6 @@ } this._root = GetTemplateChild(PART_Root) as FrameworkElement; - this._resizer = GetTemplateChild(PART_Resizer) as FrameworkElement; if (this._root != null) { @@ -1118,19 +1077,6 @@ } //TODO: Figure out why I can't wire up the event below in SubscribeToTemplatePartEvents this._root.MouseLeftButtonDown += new MouseButtonEventHandler(this.ContentRoot_MouseLeftButtonDown); - - if (this.ResizeMode == ResizeMode.CanResize) - { - this._resizer.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(Resizer_MouseLeftButtonDown); - this._resizer.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(Resizer_MouseLeftButtonUp); - this._resizer.MouseMove += new System.Windows.Input.MouseEventHandler(Resizer_MouseMove); - this._resizer.MouseEnter += new MouseEventHandler(Resizer_MouseEnter); - this._resizer.MouseLeave += new MouseEventHandler(Resizer_MouseLeave); - } - else - { - this._resizer.Opacity = 0; - } } this.ContentRoot = GetTemplateChild(PART_ContentRoot) as FrameworkElement; @@ -1157,21 +1103,6 @@ } } - void Resizer_MouseLeave(object sender, MouseEventArgs e) - { - if (!this._isMouseCaptured) - { - this._resizer.Opacity = .25; - } - } - - void Resizer_MouseEnter(object sender, MouseEventArgs e) - { - if (!this._isMouseCaptured) - { - this._resizer.Opacity = 1; - } - } /// <summary> /// Raises the @@ -1453,10 +1384,6 @@ this._chrome.MouseMove += new MouseEventHandler(this.Chrome_MouseMove); } - if (this._contentPresenter != null) - { - this._contentPresenter.SizeChanged += new SizeChangedEventHandler(this.ContentPresenter_SizeChanged); - } } /// <summary> @@ -1494,11 +1421,6 @@ this._chrome.MouseLeftButtonUp -= new MouseButtonEventHandler(this.Chrome_MouseLeftButtonUp); this._chrome.MouseMove -= new MouseEventHandler(this.Chrome_MouseMove); } - - if (this._contentPresenter != null) - { - this._contentPresenter.SizeChanged -= new SizeChangedEventHandler(this.ContentPresenter_SizeChanged); - } } /// <summary>