Mercurial > silverbladetech
changeset 80:62889c14148e
clear rubbish
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Mon, 23 Apr 2012 23:07:33 +0100 |
parents | 5172a9b9800c |
children | 4ea16a799a03 |
files | SilverlightGlimpse/FloatableWindow/FloatableWindow.cs SilverlightGlimpse/FloatableWindow/FloatableWindow.csproj SilverlightGlimpse/FloatableWindow/FloatableWindow.sln SilverlightGlimpse/FloatableWindow/FloatableWindowAutomationPeer.cs SilverlightGlimpse/FloatableWindow/Properties/AssemblyInfo.cs SilverlightGlimpse/FloatableWindow/Properties/Resources.Designer.cs SilverlightGlimpse/FloatableWindow/Properties/Resources.resx SilverlightGlimpse/FloatableWindow/themes/generic.xaml SilverlightGlimpse/SilverlightGlimpse.Test/App.xaml SilverlightGlimpse/SilverlightGlimpse.Test/App.xaml.cs SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs SilverlightGlimpse/SilverlightGlimpse.Test/Properties/AppManifest.xml SilverlightGlimpse/SilverlightGlimpse.Test/Properties/AssemblyInfo.cs SilverlightGlimpse/SilverlightGlimpse.Test/SilverlightGlimpse.Test.csproj |
diffstat | 15 files changed, 0 insertions(+), 3390 deletions(-) [+] |
line wrap: on
line diff
--- a/SilverlightGlimpse/FloatableWindow/FloatableWindow.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1620 +0,0 @@ -// This source is subject to the Microsoft Public License (Ms-PL). -// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. -// All other rights reserved. - -using System.Collections; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows.Automation; -using System.Windows.Automation.Peers; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; - -namespace System.Windows.Controls -{ - /// <summary> - /// Provides a window that can be displayed over a parent window and blocks - /// interaction with the parent window. - /// </summary> - /// <QualityBand>Preview</QualityBand> - [TemplatePart(Name = PART_Chrome, Type = typeof(FrameworkElement))] - [TemplatePart(Name = PART_CloseButton, Type = typeof(ButtonBase))] - [TemplatePart(Name = PART_ContentPresenter, Type = typeof(FrameworkElement))] - [TemplatePart(Name = PART_ContentRoot, Type = typeof(FrameworkElement))] - [TemplatePart(Name = PART_Overlay, Type = typeof(Panel))] - [TemplatePart(Name = PART_Root, Type = typeof(FrameworkElement))] - [TemplateVisualState(Name = VSMSTATE_StateClosed, GroupName = VSMGROUP_Window)] - [TemplateVisualState(Name = VSMSTATE_StateOpen, GroupName = VSMGROUP_Window)] - public class FloatableWindow : ContentControl - { - #region Static Fields and Constants - - /// <summary> - /// The name of the Chrome template part. - /// </summary> - private const string PART_Chrome = "Chrome"; - - /// <summary> - /// The name of the CloseButton template part. - /// </summary> - private const string PART_CloseButton = "CloseButton"; - - /// <summary> - /// The name of the ContentPresenter template part. - /// </summary> - private const string PART_ContentPresenter = "ContentPresenter"; - - /// <summary> - /// The name of the ContentRoot template part. - /// </summary> - private const string PART_ContentRoot = "ContentRoot"; - - /// <summary> - /// The name of the Overlay template part. - /// </summary> - private const string PART_Overlay = "Overlay"; - - /// <summary> - /// The name of the Root template part. - /// </summary> - private const string PART_Root = "Root"; - - /// <summary> - /// The name of the WindowStates VSM group. - /// </summary> - private const string VSMGROUP_Window = "WindowStates"; - - /// <summary> - /// The name of the Closing VSM state. - /// </summary> - private const string VSMSTATE_StateClosed = "Closed"; - - /// <summary> - /// The name of the Opening VSM state. - /// </summary> - private const string VSMSTATE_StateOpen = "Open"; - - #region public bool HasCloseButton - - /// <summary> - /// Gets or sets a value indicating whether the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> has a close - /// button. - /// </summary> - /// <value> - /// True if the child window has a close button; otherwise, false. The - /// default is true. - /// </value> - public bool HasCloseButton - { - get { return (bool)GetValue(HasCloseButtonProperty); } - set { SetValue(HasCloseButtonProperty, value); } - } - - /// <summary> - /// Identifies the - /// <see cref="P:System.Windows.Controls.FloatableWindow.HasCloseButton" /> - /// dependency property. - /// </summary> - /// <value> - /// The identifier for the - /// <see cref="P:System.Windows.Controls.FloatableWindow.HasCloseButton" /> - /// dependency property. - /// </value> - public static readonly DependencyProperty HasCloseButtonProperty = - DependencyProperty.Register( - "HasCloseButton", - typeof(bool), - typeof(FloatableWindow), - new PropertyMetadata(true, OnHasCloseButtonPropertyChanged)); - - /// <summary> - /// HasCloseButtonProperty PropertyChangedCallback call back static function. - /// </summary> - /// <param name="d">FloatableWindow object whose HasCloseButton property is changed.</param> - /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> - private static void OnHasCloseButtonPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - FloatableWindow cw = (FloatableWindow)d; - - if (cw.CloseButton != null) - { - if ((bool)e.NewValue) - { - cw.CloseButton.Visibility = Visibility.Visible; - } - else - { - cw.CloseButton.Visibility = Visibility.Collapsed; - } - } - } - - #endregion public bool HasCloseButton - - #region public Brush OverlayBrush - - /// <summary> - /// Gets or sets the visual brush that is used to cover the parent - /// window when the child window is open. - /// </summary> - /// <value> - /// The visual brush that is used to cover the parent window when the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> is open. The - /// default is null. - /// </value> - public Brush OverlayBrush - { - get { return (Brush)GetValue(OverlayBrushProperty); } - set { SetValue(OverlayBrushProperty, value); } - } - - /// <summary> - /// Identifies the - /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayBrush" /> - /// dependency property. - /// </summary> - /// <value> - /// The identifier for the - /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayBrush" /> - /// dependency property. - /// </value> - public static readonly DependencyProperty OverlayBrushProperty = - DependencyProperty.Register( - "OverlayBrush", - typeof(Brush), - typeof(FloatableWindow), - new PropertyMetadata(OnOverlayBrushPropertyChanged)); - - /// <summary> - /// OverlayBrushProperty PropertyChangedCallback call back static function. - /// </summary> - /// <param name="d">FloatableWindow object whose OverlayBrush property is changed.</param> - /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> - private static void OnOverlayBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - FloatableWindow cw = (FloatableWindow)d; - - if (cw.Overlay != null) - { - cw.Overlay.Background = (Brush)e.NewValue; - } - } - - #endregion public Brush OverlayBrush - - #region public double OverlayOpacity - - /// <summary> - /// Gets or sets the opacity of the overlay brush that is used to cover - /// the parent window when the child window is open. - /// </summary> - /// <value> - /// The opacity of the overlay brush that is used to cover the parent - /// window when the <see cref="T:System.Windows.Controls.FloatableWindow" /> - /// is open. The default is 1.0. - /// </value> - public double OverlayOpacity - { - get { return (double)GetValue(OverlayOpacityProperty); } - set { SetValue(OverlayOpacityProperty, value); } - } - - /// <summary> - /// Identifies the - /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayOpacity" /> - /// dependency property. - /// </summary> - /// <value> - /// The identifier for the - /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayOpacity" /> - /// dependency property. - /// </value> - public static readonly DependencyProperty OverlayOpacityProperty = - DependencyProperty.Register( - "OverlayOpacity", - typeof(double), - typeof(FloatableWindow), - new PropertyMetadata(OnOverlayOpacityPropertyChanged)); - - /// <summary> - /// OverlayOpacityProperty PropertyChangedCallback call back static function. - /// </summary> - /// <param name="d">FloatableWindow object whose OverlayOpacity property is changed.</param> - /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> - private static void OnOverlayOpacityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - FloatableWindow cw = (FloatableWindow)d; - - if (cw.Overlay != null) - { - cw.Overlay.Opacity = (double)e.NewValue; - } - } - - #endregion public double OverlayOpacity - - #region private static Control RootVisual - - /// <summary> - /// Gets the root visual element. - /// </summary> - private static Control RootVisual - { - get - { - return Application.Current == null ? null : (Application.Current.RootVisual as Control); - } - } - - #endregion private static Control RootVisual - - #region public object Title - - /// <summary> - /// Gets or sets the title that is displayed in the frame of the - /// <see cref="T:System.Windows.Controls.FloatableWindow" />. - /// </summary> - /// <value> - /// The title displayed at the top of the window. The default is null. - /// </value> - public object Title - { - get { return GetValue(TitleProperty); } - set { SetValue(TitleProperty, value); } - } - - /// <summary> - /// Identifies the - /// <see cref="P:System.Windows.Controls.FloatableWindow.Title" /> - /// dependency property. - /// </summary> - /// <value> - /// The identifier for the - /// <see cref="P:System.Windows.Controls.FloatableWindow.Title" /> - /// dependency property. - /// </value> - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register( - "Title", - typeof(object), - typeof(FloatableWindow), - null); - - #endregion public object Title - - #endregion Static Fields and Constants - - #region Member Fields - /// <summary> - /// Set in the overloaded Show method. Offsets the Popup vertically from the top left corner of the browser window by this amount. - /// </summary> - private double _verticalOffset; - - /// <summary> - /// Set in the overloaded Show method. Offsets the Popup horizontally from the top left corner of the browser window by this amount. - /// </summary> - private double _horizontalOffset; - - /// <summary> - /// Private accessor for the Resizer. - /// </summary> - private FrameworkElement _resizer; - - /// <summary> - /// Private accessor for the IsModal - /// </summary> - [DefaultValue(false)] - private bool _modal; - - /// <summary> - /// Private accessor for the Chrome. - /// </summary> - private FrameworkElement _chrome; - - /// <summary> - /// Private accessor for the click point on the chrome. - /// </summary> - private Point _clickPoint; - - /// <summary> - /// Private accessor for the Closing storyboard. - /// </summary> - private Storyboard _closed; - - /// <summary> - /// Private accessor for the ContentPresenter. - /// </summary> - private FrameworkElement _contentPresenter; - - /// <summary> - /// Private accessor for the translate transform that needs to be applied on to the ContentRoot. - /// </summary> - private TranslateTransform _contentRootTransform; - - /// <summary> - /// Content area desired width. - /// </summary> - private double _desiredContentWidth; - - /// <summary> - /// Content area desired height. - /// </summary> - private double _desiredContentHeight; - - /// <summary> - /// Desired margin for the window. - /// </summary> - private Thickness _desiredMargin; - - /// <summary> - /// Private accessor for the Dialog Result property. - /// </summary> - private bool? _dialogresult; - - /// <summary> - /// Private accessor for the FloatableWindow InteractionState. - /// </summary> - private WindowInteractionState _interactionState; - - /// <summary> - /// Boolean value that specifies whether the application is exit or not. - /// </summary> - private bool _isAppExit; - - /// <summary> - /// Boolean value that specifies whether the window is in closing state or not. - /// </summary> - private bool _isClosing; - - /// <summary> - /// Boolean value that specifies whether the window is opened. - /// </summary> - private bool _isOpen; - - /// <summary> - /// Private accessor for the Opening storyboard. - /// </summary> - private Storyboard _opened; - - /// <summary> - /// Boolean value that specifies whether the mouse is captured or not. - /// </summary> - private bool _isMouseCaptured; - - /// <summary> - /// Private accessor for the Root of the window. - /// </summary> - private FrameworkElement _root; - - /// <summary> - /// Private accessor for the position of the window with respect to RootVisual. - /// </summary> - private Point _windowPosition; - - private static int z; - - #endregion Member Fields - - #region Constructors - - /// <summary> - /// Initializes a new instance of the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> class. - /// </summary> - public FloatableWindow() - { - this.DefaultStyleKey = typeof(FloatableWindow); - this.InteractionState = WindowInteractionState.NotResponding; - } - - #endregion Constructors - - #region Events - - /// <summary> - /// Occurs when the <see cref="T:System.Windows.Controls.FloatableWindow" /> - /// is closed. - /// </summary> - public event EventHandler Closed; - - /// <summary> - /// Occurs when the <see cref="T:System.Windows.Controls.FloatableWindow" /> - /// is closing. - /// </summary> - public event EventHandler<CancelEventArgs> Closing; - - #endregion Events - - #region Properties - - private Panel _parentLayoutRoot; - public Panel ParentLayoutRoot - { - get { return _parentLayoutRoot; } - set { _parentLayoutRoot = value; } - } - - /// <summary> - /// Gets the internal accessor for the ContentRoot of the window. - /// </summary> - internal FrameworkElement ContentRoot - { - get; - private set; - } - - /// <summary> - /// Setting for the horizontal positioning offset for start position - /// </summary> - public double HorizontalOffset - { - get { return _horizontalOffset; } - set { _horizontalOffset = value; } - } - - /// <summary> - /// Setting for the vertical positioning offset for start position - /// </summary> - public double VerticalOffset - { - get { return _verticalOffset; } - set { _verticalOffset = value; } - } - - /// <summary> - /// Gets the internal accessor for the modal of the window. - /// </summary> - public bool IsModal - { - get - { - return _modal; - } - } - - /// <summary> - /// Gets or sets a value indicating whether the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> was accepted or - /// canceled. - /// </summary> - /// <value> - /// True if the child window was accepted; false if the child window was - /// canceled. The default is null. - /// </value> - [TypeConverter(typeof(NullableBoolConverter))] - public bool? DialogResult - { - get - { - return this._dialogresult; - } - - set - { - if (this._dialogresult != value) - { - this._dialogresult = value; - this.Close(); - } - } - } - - /// <summary> - /// Gets the internal accessor for the PopUp of the window. - /// </summary> - internal Popup ChildWindowPopup - { - get; - private set; - } - - /// <summary> - /// Gets the internal accessor for the close button of the window. - /// </summary> - internal ButtonBase CloseButton - { - get; - private set; - } - - /// <summary> - /// Gets the InteractionState for the FloatableWindow. - /// </summary> - internal WindowInteractionState InteractionState - { - get - { - return this._interactionState; - } - private set - { - if (this._interactionState != value) - { - WindowInteractionState oldValue = this._interactionState; - this._interactionState = value; - FloatableWindowAutomationPeer peer = FloatableWindowAutomationPeer.FromElement(this) as FloatableWindowAutomationPeer; - - if (peer != null) - { - peer.RaiseInteractionStatePropertyChangedEvent(oldValue, this._interactionState); - } - } - } - } - - /// <summary> - /// Gets a value indicating whether the PopUp is open or not. - /// </summary> - private bool IsOpen - { - get - { - return (this.ChildWindowPopup != null && this.ChildWindowPopup.IsOpen) || - ((ParentLayoutRoot != null) && (ParentLayoutRoot.Children.Contains(this))); - } - } - - /// <summary> - /// Gets the internal accessor for the overlay of the window. - /// </summary> - internal Panel Overlay - { - get; - private set; - } - - #endregion Properties - - #region Static Methods - - /// <summary> - /// Inverts the input matrix. - /// </summary> - /// <param name="matrix">The matrix values that is to be inverted.</param> - /// <returns>Returns a value indicating whether the inversion was successful or not.</returns> - private static bool InvertMatrix(ref Matrix matrix) - { - double determinant = (matrix.M11 * matrix.M22) - (matrix.M12 * matrix.M21); - - if (determinant == 0.0) - { - return false; - } - - Matrix matCopy = matrix; - matrix.M11 = matCopy.M22 / determinant; - matrix.M12 = -1 * matCopy.M12 / determinant; - matrix.M21 = -1 * matCopy.M21 / determinant; - matrix.M22 = matCopy.M11 / determinant; - matrix.OffsetX = ((matCopy.OffsetY * matCopy.M21) - (matCopy.OffsetX * matCopy.M22)) / determinant; - matrix.OffsetY = ((matCopy.OffsetX * matCopy.M12) - (matCopy.OffsetY * matCopy.M11)) / determinant; - - return true; - } - - #endregion Static Methods - - #region Methods - - /// <summary> - /// Executed when the application is exited. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">Event args.</param> - internal void Application_Exit(object sender, EventArgs e) - { - if (this.IsOpen) - { - this._isAppExit = true; - try - { - this.Close(); - } - finally - { - this._isAppExit = false; - } - } - } - - /// <summary> - /// Executed when focus is given to the window via a click. Attempts to bring current - /// window to the front in the event there are more windows. - /// </summary> - internal void BringToFront() - { - z++; - Canvas.SetZIndex(this, z); -#if DEBUG - this.Title = z.ToString(); -#endif - } - - /// <summary> - /// Changes the visual state of the FloatableWindow. - /// </summary> - private void ChangeVisualState() - { - if (this._isClosing) - { - VisualStateManager.GoToState(this, VSMSTATE_StateClosed, true); - } - else - { - VisualStateManager.GoToState(this, VSMSTATE_StateOpen, true); - BringToFront(); - } - } - - /// <summary> - /// Executed when FloatableWindow size is changed. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Size changed event args.</param> - private void ChildWindow_SizeChanged(object sender, SizeChangedEventArgs e) - { - if (_modal) - { - if (this.Overlay != null) - { - if (e.NewSize.Height != this.Overlay.Height) - { - this._desiredContentHeight = e.NewSize.Height; - } - - if (e.NewSize.Width != this.Overlay.Width) - { - this._desiredContentWidth = e.NewSize.Width; - } - } - - if (this.IsOpen) - { - this.UpdateOverlaySize(); - } - } - } - - /// <summary> - /// Closes a <see cref="T:System.Windows.Controls.FloatableWindow" />. - /// </summary> - public void Close() - { - // AutomationPeer returns "Closing" when Close() is called - // but the window is not closed completely: - this.InteractionState = WindowInteractionState.Closing; - CancelEventArgs e = new CancelEventArgs(); - this.OnClosing(e); - - // On ApplicationExit, close() cannot be cancelled - if (!e.Cancel || this._isAppExit) - { - if (RootVisual != null) - { - RootVisual.IsEnabled = true; - } - - // Close Popup - if (this.IsOpen) - { - if (this._closed != null) - { - // Popup will be closed when the storyboard ends - this._isClosing = true; - try - { - var sb = GetVisualStateStoryboard("WindowStates", "Closed"); - sb.Completed += (s, args) => - { - this.ParentLayoutRoot.Children.Remove(this); - this.OnClosed(EventArgs.Empty); - this.UnSubscribeFromEvents(); - this.UnsubscribeFromTemplatePartEvents(); - - if (Application.Current.RootVisual != null) - { - Application.Current.RootVisual.GotFocus -= new RoutedEventHandler(this.RootVisual_GotFocus); - } - }; - this.ChangeVisualState(); - } - finally - { - this._isClosing = false; - } - } - else - { - // If no closing storyboard is defined, close the Popup - this.ChildWindowPopup.IsOpen = false; - } - - if (!this._dialogresult.HasValue) - { - // If close action is not happening because of DialogResult property change action, - // Dialogresult is always false: - this._dialogresult = false; - } - - //this.OnClosed(EventArgs.Empty); - //this.UnSubscribeFromEvents(); - //this.UnsubscribeFromTemplatePartEvents(); - - //if (Application.Current.RootVisual != null) - //{ - // Application.Current.RootVisual.GotFocus -= new RoutedEventHandler(this.RootVisual_GotFocus); - //} - } - } - else - { - // If the Close is cancelled, DialogResult should always be NULL: - this._dialogresult = null; - this.InteractionState = WindowInteractionState.Running; - } - } - - /// <summary> - /// Brings the window to the front of others - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - internal void ContentRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - BringToFront(); - } - - /// <summary> - /// Executed when the CloseButton is clicked. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Routed event args.</param> - internal void CloseButton_Click(object sender, RoutedEventArgs e) - { - this.Close(); - } - - /// <summary> - /// Executed when the Closing storyboard ends. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Event args.</param> - private void Closing_Completed(object sender, EventArgs e) - { - if (this.ChildWindowPopup != null) - { - this.ChildWindowPopup.IsOpen = false; - } - - // AutomationPeer returns "NotResponding" when the FloatableWindow is closed: - this.InteractionState = WindowInteractionState.NotResponding; - - if (this._closed != null) - { - this._closed.Completed -= new EventHandler(this.Closing_Completed); - } - } - - /// <summary> - /// Executed when the a key is presses when the window is open. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Key event args.</param> - private void ChildWindow_KeyDown(object sender, KeyEventArgs e) - { - FloatableWindow ew = sender as FloatableWindow; - Debug.Assert(ew != null, "FloatableWindow instance is null."); - - // Ctrl+Shift+F4 closes the FloatableWindow - if (e != null && !e.Handled && e.Key == Key.F4 && - ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) && - ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)) - { - ew.Close(); - e.Handled = true; - } - } - - /// <summary> - /// Executed when the window loses focus. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Routed event args.</param> - private void ChildWindow_LostFocus(object sender, RoutedEventArgs e) - { - // If the FloatableWindow loses focus but the popup is still open, - // it means another popup is opened. To get the focus back when the - // popup is closed, we handle GotFocus on the RootVisual - // TODO: Something else could get focus and handle the GotFocus event right. - // Try listening to routed events that were Handled (new SL 3 feature) - // Blocked by Jolt bug #29419 - if (this.IsOpen && Application.Current != null && Application.Current.RootVisual != null) - { - this.InteractionState = WindowInteractionState.BlockedByModalWindow; - Application.Current.RootVisual.GotFocus += new RoutedEventHandler(this.RootVisual_GotFocus); - } - } - - /// <summary> - /// Executed when mouse left button is down on the chrome. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Mouse button event args.</param> - private void Chrome_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - if (this._chrome != null) - { - e.Handled = true; - - if (this.CloseButton != null && !this.CloseButton.IsTabStop) - { - this.CloseButton.IsTabStop = true; - try - { - this.Focus(); - } - finally - { - this.CloseButton.IsTabStop = false; - } - } - else - { - this.Focus(); - } - this._chrome.CaptureMouse(); - this._isMouseCaptured = true; - this._clickPoint = e.GetPosition(sender as UIElement); -#if DEBUG - this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); -#endif - } - } - - /// <summary> - /// Executed when mouse left button is up on the chrome. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Mouse button event args.</param> - private void Chrome_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - if (this._chrome != null) - { - //e.Handled = true; - this._chrome.ReleaseMouseCapture(); - this._isMouseCaptured = false; - } - } - - /// <summary> - /// Executed when mouse moves on the chrome. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Mouse event args.</param> - private void Chrome_MouseMove(object sender, MouseEventArgs e) - { - #region New ChildWindow Code not working - //if (this._isMouseCaptured && this.ContentRoot != null && Application.Current != null && Application.Current.RootVisual != null) - //{ - // Point position = e.GetPosition(Application.Current.RootVisual); - - // GeneralTransform gt = this.ContentRoot.TransformToVisual(Application.Current.RootVisual); - - // if (gt != null) - // { - // Point p = gt.Transform(this._clickPoint); - // this._windowPosition = gt.Transform(new Point(0, 0)); - - // if (position.X < 0) - // { - // double Y = FindPositionY(p, position, 0); - // position = new Point(0, Y); - // } - - // if (position.X > this.Width) - // { - // double Y = FindPositionY(p, position, this.Width); - // position = new Point(this.Width, Y); - // } - - // if (position.Y < 0) - // { - // double X = FindPositionX(p, position, 0); - // position = new Point(X, 0); - // } - - // if (position.Y > this.Height) - // { - // double X = FindPositionX(p, position, this.Height); - // position = new Point(X, this.Height); - // } - - // double x = position.X - p.X; - // double y = position.Y - p.Y; - // UpdateContentRootTransform(x, y); - // } - //} - #endregion - if (this._isMouseCaptured && this.ContentRoot != null) - { - // If the child window is dragged out of the page, return - if (Application.Current != null && Application.Current.RootVisual != null && - (e.GetPosition(Application.Current.RootVisual).X < 0 || e.GetPosition(Application.Current.RootVisual).Y < 0)) - { - return; - } - - TransformGroup transformGroup = this.ContentRoot.RenderTransform as TransformGroup; - - if (transformGroup == null) - { - transformGroup = new TransformGroup(); - transformGroup.Children.Add(this.ContentRoot.RenderTransform); - } - - TranslateTransform t = new TranslateTransform(); - t.X = e.GetPosition(this.ContentRoot).X - this._clickPoint.X; - t.Y = e.GetPosition(this.ContentRoot).Y - this._clickPoint.Y; - if (transformGroup != null) - { - transformGroup.Children.Add(t); - this.ContentRoot.RenderTransform = transformGroup; - } - } - } - - /// <summary> - /// Finds the X coordinate of a point that is defined by a line. - /// </summary> - /// <param name="p1">Starting point of the line.</param> - /// <param name="p2">Ending point of the line.</param> - /// <param name="y">Y coordinate of the point.</param> - /// <returns>X coordinate of the point.</returns> - private static double FindPositionX(Point p1, Point p2, double y) - { - if (y == p1.Y || p1.X == p2.X) - { - return p2.X; - } - - Debug.Assert(p1.Y != p2.Y, "Unexpected equal Y coordinates"); - - return (((y - p1.Y) * (p1.X - p2.X)) / (p1.Y - p2.Y)) + p1.X; - } - - /// <summary> - /// Finds the Y coordinate of a point that is defined by a line. - /// </summary> - /// <param name="p1">Starting point of the line.</param> - /// <param name="p2">Ending point of the line.</param> - /// <param name="x">X coordinate of the point.</param> - /// <returns>Y coordinate of the point.</returns> - private static double FindPositionY(Point p1, Point p2, double x) - { - if (p1.Y == p2.Y || x == p1.X) - { - return p2.Y; - } - - Debug.Assert(p1.X != p2.X, "Unexpected equal X coordinates"); - - return (((p1.Y - p2.Y) * (x - p1.X)) / (p1.X - p2.X)) + p1.Y; - } - - /// <summary> - /// Builds the visual tree for the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> control when a - /// new template is applied. - /// </summary> - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "No need to split the code into two parts.")] - public override void OnApplyTemplate() - { - this.UnsubscribeFromTemplatePartEvents(); - - base.OnApplyTemplate(); - - this.CloseButton = GetTemplateChild(PART_CloseButton) as ButtonBase; - - if (this.CloseButton != null) - { - if (this.HasCloseButton) - { - this.CloseButton.Visibility = Visibility.Visible; - } - else - { - this.CloseButton.Visibility = Visibility.Collapsed; - } - } - - if (this._closed != null) - { - this._closed.Completed -= new EventHandler(this.Closing_Completed); - } - - if (this._opened != null) - { - this._opened.Completed -= new EventHandler(this.Opening_Completed); - } - - this._root = GetTemplateChild(PART_Root) as FrameworkElement; - - if (this._root != null) - { - IList groups = VisualStateManager.GetVisualStateGroups(this._root); - - if (groups != null) - { - IList states = null; - - foreach (VisualStateGroup vsg in groups) - { - if (vsg.Name == FloatableWindow.VSMGROUP_Window) - { - states = vsg.States; - break; - } - } - - if (states != null) - { - foreach (VisualState state in states) - { - if (state.Name == FloatableWindow.VSMSTATE_StateClosed) - { - this._closed = state.Storyboard; - } - - if (state.Name == FloatableWindow.VSMSTATE_StateOpen) - { - this._opened = state.Storyboard; - } - } - } - } - //TODO: Figure out why I can't wire up the event below in SubscribeToTemplatePartEvents - this._root.MouseLeftButtonDown += new MouseButtonEventHandler(this.ContentRoot_MouseLeftButtonDown); - } - - this.ContentRoot = GetTemplateChild(PART_ContentRoot) as FrameworkElement; - - this._chrome = GetTemplateChild(PART_Chrome) as FrameworkElement; - - this.Overlay = GetTemplateChild(PART_Overlay) as Panel; - - this._contentPresenter = GetTemplateChild(PART_ContentPresenter) as FrameworkElement; - - this.SubscribeToTemplatePartEvents(); - this.SubscribeToStoryBoardEvents(); - this._desiredMargin = this.Margin; - this.Margin = new Thickness(0); - - // Update overlay size - if (this.IsOpen && (this.ChildWindowPopup != null)) - { - this._desiredContentHeight = this.Height; - this._desiredContentWidth = this.Width; - this.UpdateOverlaySize(); - this.UpdateRenderTransform(); - this.ChangeVisualState(); - } - } - - - /// <summary> - /// Raises the - /// <see cref="E:System.Windows.Controls.FloatableWindow.Closed" /> event. - /// </summary> - /// <param name="e">The event data.</param> - protected virtual void OnClosed(EventArgs e) - { - EventHandler handler = this.Closed; - - if (null != handler) - { - handler(this, e); - } - - this._isOpen = false; - if (!_modal) - { - this.ParentLayoutRoot.Children.Remove(this); - } - } - - /// <summary> - /// Raises the - /// <see cref="E:System.Windows.Controls.FloatableWindow.Closing" /> event. - /// </summary> - /// <param name="e">The event data.</param> - protected virtual void OnClosing(CancelEventArgs e) - { - EventHandler<CancelEventArgs> handler = this.Closing; - - if (null != handler) - { - handler(this, e); - } - } - - /// <summary> - /// Returns a - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" /> - /// for use by the Silverlight automation infrastructure. - /// </summary> - /// <returns> - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" /> - /// for the <see cref="T:System.Windows.Controls.FloatableWindow" /> object. - /// </returns> - protected override AutomationPeer OnCreateAutomationPeer() - { - return new FloatableWindowAutomationPeer(this); - } - - /// <summary> - /// This method is called every time a - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> is displayed. - /// </summary> - protected virtual void OnOpened() - { - this.UpdatePosition(); - this._isOpen = true; - - if (this.Overlay != null) - { - this.Overlay.Opacity = this.OverlayOpacity; - this.Overlay.Background = this.OverlayBrush; - } - - if (!this.Focus()) - { - // If the Focus() fails it means there is no focusable element in the - // FloatableWindow. In this case we set IsTabStop to true to have the keyboard functionality - this.IsTabStop = true; - this.Focus(); - } - } - - /// <summary> - /// Executed when the opening storyboard finishes. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Event args.</param> - private void Opening_Completed(object sender, EventArgs e) - { - if (this._opened != null) - { - this._opened.Completed -= new EventHandler(this.Opening_Completed); - } - // AutomationPeer returns "ReadyForUserInteraction" when the FloatableWindow - // is open and all animations have been completed. - this.InteractionState = WindowInteractionState.ReadyForUserInteraction; - this.OnOpened(); - } - - /// <summary> - /// Executed when the page resizes. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Event args.</param> - private void Page_Resized(object sender, EventArgs e) - { - if (this.ChildWindowPopup != null) - { - this.UpdateOverlaySize(); - } - } - - /// <summary> - /// Executed when the root visual gets focus. - /// </summary> - /// <param name="sender">Sender object.</param> - /// <param name="e">Routed event args.</param> - private void RootVisual_GotFocus(object sender, RoutedEventArgs e) - { - this.Focus(); - this.InteractionState = WindowInteractionState.ReadyForUserInteraction; - } - - public void Show() - { - ShowWindow(false); - } - - public void ShowDialog() - { - _verticalOffset = 0; - _horizontalOffset = 0; - ShowWindow(true); - } - - public void Show(double horizontalOffset, double verticalOffset) - { - _horizontalOffset = horizontalOffset; - _verticalOffset = verticalOffset; - ShowWindow(false); - } - - /// <summary> - /// Opens a <see cref="T:System.Windows.Controls.FloatableWindow" /> and - /// returns without waiting for the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> to close. - /// </summary> - /// <exception cref="T:System.InvalidOperationException"> - /// The child window is already in the visual tree. - /// </exception> - internal void ShowWindow(bool isModal) - { - _modal = isModal; - - // AutomationPeer returns "Running" when Show() is called - // but the FloatableWindow is not ready for user interaction: - this.InteractionState = WindowInteractionState.Running; - - this.SubscribeToEvents(); - this.SubscribeToTemplatePartEvents(); - this.SubscribeToStoryBoardEvents(); - - - // MaxHeight and MinHeight properties should not be overwritten: - this.MaxHeight = double.PositiveInfinity; - this.MaxWidth = double.PositiveInfinity; - - if (_modal) - { - if (this.ChildWindowPopup == null) - { - this.ChildWindowPopup = new Popup(); - - try - { - this.ChildWindowPopup.Child = this; - } - catch (ArgumentException) - { - // If the FloatableWindow is already in the visualtree, we cannot set it to be the child of the popup - // we are throwing a friendlier exception for this case: - this.InteractionState = WindowInteractionState.NotResponding; - throw new InvalidOperationException(Properties.Resources.ChildWindow_InvalidOperation); - } - } - - if (this.ChildWindowPopup != null && Application.Current.RootVisual != null) - { - this.ChildWindowPopup.IsOpen = true; - - this.ChildWindowPopup.HorizontalOffset = _horizontalOffset; - this.ChildWindowPopup.VerticalOffset = _verticalOffset; - - // while the FloatableWindow is open, the DialogResult is always NULL: - this._dialogresult = null; - } - } - else - { - if (ParentLayoutRoot != null) - { - this.SetValue(Canvas.TopProperty, _verticalOffset); - this.SetValue(Canvas.LeftProperty, _horizontalOffset); - this.ParentLayoutRoot.Children.Add(this); - this.BringToFront(); - } - else - { - throw new ArgumentNullException("ParentLayoutRoot", "You need to specify a root Panel element to add the window elements to."); - } - } - - // disable the underlying UI - if (RootVisual != null && _modal) - { - RootVisual.IsEnabled = false; - } - - // if the template is already loaded, display loading visuals animation - if (this.ContentRoot == null) - { - this.Loaded += (s, args) => - { - if (this.ContentRoot != null) - { - this.ChangeVisualState(); - } - }; - } - else - { - this.ChangeVisualState(); - } - } - - /// <summary> - /// Subscribes to events when the FloatableWindow is opened. - /// </summary> - private void SubscribeToEvents() - { - if (Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) - { - Application.Current.Exit += new EventHandler(this.Application_Exit); - Application.Current.Host.Content.Resized += new EventHandler(this.Page_Resized); - } - - this.KeyDown += new KeyEventHandler(this.ChildWindow_KeyDown); - if (_modal) - { - this.LostFocus += new RoutedEventHandler(this.ChildWindow_LostFocus); - } - this.SizeChanged += new SizeChangedEventHandler(this.ChildWindow_SizeChanged); - } - - /// <summary> - /// Subscribes to events that are on the storyboards. - /// Unsubscribing from these events happen in the event handlers individually. - /// </summary> - private void SubscribeToStoryBoardEvents() - { - if (this._closed != null) - { - this._closed.Completed += new EventHandler(this.Closing_Completed); - } - - if (this._opened != null) - { - this._opened.Completed += new EventHandler(this.Opening_Completed); - } - } - - /// <summary> - /// Subscribes to events on the template parts. - /// </summary> - private void SubscribeToTemplatePartEvents() - { - if (this.CloseButton != null) - { - this.CloseButton.Click += new RoutedEventHandler(this.CloseButton_Click); - } - - if (this._chrome != null) - { - this._chrome.MouseLeftButtonDown += new MouseButtonEventHandler(this.Chrome_MouseLeftButtonDown); - this._chrome.MouseLeftButtonUp += new MouseButtonEventHandler(this.Chrome_MouseLeftButtonUp); - this._chrome.MouseMove += new MouseEventHandler(this.Chrome_MouseMove); - } - - } - - /// <summary> - /// Unsubscribe from events when the FloatableWindow is closed. - /// </summary> - private void UnSubscribeFromEvents() - { - if (Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) - { - Application.Current.Exit -= new EventHandler(this.Application_Exit); - Application.Current.Host.Content.Resized -= new EventHandler(this.Page_Resized); - } - - this.KeyDown -= new KeyEventHandler(this.ChildWindow_KeyDown); - if (_modal) - { - this.LostFocus -= new RoutedEventHandler(this.ChildWindow_LostFocus); - } - this.SizeChanged -= new SizeChangedEventHandler(this.ChildWindow_SizeChanged); - } - - /// <summary> - /// Unsubscribe from the events that are subscribed on the template part elements. - /// </summary> - private void UnsubscribeFromTemplatePartEvents() - { - if (this.CloseButton != null) - { - this.CloseButton.Click -= new RoutedEventHandler(this.CloseButton_Click); - } - - if (this._chrome != null) - { - this._chrome.MouseLeftButtonDown -= new MouseButtonEventHandler(this.Chrome_MouseLeftButtonDown); - this._chrome.MouseLeftButtonUp -= new MouseButtonEventHandler(this.Chrome_MouseLeftButtonUp); - this._chrome.MouseMove -= new MouseEventHandler(this.Chrome_MouseMove); - } - } - - /// <summary> - /// Updates the size of the overlay of the window. - /// </summary> - private void UpdateOverlaySize() - { - if (_modal) - { - if (this.Overlay != null && Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) - { - this.Height = Application.Current.Host.Content.ActualHeight; - this.Width = Application.Current.Host.Content.ActualWidth; - this.Overlay.Height = this.Height; - this.Overlay.Width = this.Width; - - if (this.ContentRoot != null) - { - this.ContentRoot.Width = this._desiredContentWidth; - this.ContentRoot.Height = this._desiredContentHeight; - this.ContentRoot.Margin = this._desiredMargin; - } - } - } - else - { - if (this.Overlay != null) - { - this.Overlay.Visibility = Visibility.Collapsed; - } - } - } - - /// <summary> - /// Updates the position of the window in case the size of the content changes. - /// This allows FloatableWindow only scale from right and bottom. - /// </summary> - private void UpdatePosition() - { - if (this.ContentRoot != null && Application.Current != null && Application.Current.RootVisual != null) - { - GeneralTransform gt = this.ContentRoot.TransformToVisual(Application.Current.RootVisual); - - if (gt != null) - { - this._windowPosition = gt.Transform(new Point(0, 0)); - } - } - } - - /// <summary> - /// Updates the render transform applied on the overlay. - /// </summary> - private void UpdateRenderTransform() - { - if (this._root != null && this.ContentRoot != null) - { - // The Overlay part should not be affected by the render transform applied on the - // FloatableWindow. In order to achieve this, we adjust an identity matrix to represent - // the _root's transformation, invert it, apply the inverted matrix on the _root, so that - // nothing is affected by the rendertransform, and apply the original transform only on the Content - GeneralTransform gt = this._root.TransformToVisual(null); - if (gt != null) - { - Point p10 = new Point(1, 0); - Point p01 = new Point(0, 1); - Point transform10 = gt.Transform(p10); - Point transform01 = gt.Transform(p01); - - Matrix transformToRootMatrix = Matrix.Identity; - transformToRootMatrix.M11 = transform10.X; - transformToRootMatrix.M12 = transform10.Y; - transformToRootMatrix.M21 = transform01.X; - transformToRootMatrix.M22 = transform01.Y; - - MatrixTransform original = new MatrixTransform(); - original.Matrix = transformToRootMatrix; - - InvertMatrix(ref transformToRootMatrix); - MatrixTransform mt = new MatrixTransform(); - mt.Matrix = transformToRootMatrix; - - TransformGroup tg = this._root.RenderTransform as TransformGroup; - - if (tg != null) - { - tg.Children.Add(mt); - } - else - { - this._root.RenderTransform = mt; - } - - tg = this.ContentRoot.RenderTransform as TransformGroup; - - if (tg != null) - { - tg.Children.Add(original); - } - else - { - this.ContentRoot.RenderTransform = original; - } - } - } - } - - /// <summary> - /// Updates the ContentRootTranslateTransform. - /// </summary> - /// <param name="X">X coordinate of the transform.</param> - /// <param name="Y">Y coordinate of the transform.</param> - private void UpdateContentRootTransform(double X, double Y) - { - if (this._contentRootTransform == null) - { - this._contentRootTransform = new TranslateTransform(); - this._contentRootTransform.X = X; - this._contentRootTransform.Y = Y; - - TransformGroup transformGroup = this.ContentRoot.RenderTransform as TransformGroup; - - if (transformGroup == null) - { - transformGroup = new TransformGroup(); - transformGroup.Children.Add(this.ContentRoot.RenderTransform); - } - transformGroup.Children.Add(this._contentRootTransform); - this.ContentRoot.RenderTransform = transformGroup; - } - else - { - this._contentRootTransform.X += X; - this._contentRootTransform.Y += Y; - } - } - - private void Resizer_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) - { - this._resizer.CaptureMouse(); - this._isMouseCaptured = true; - this._clickPoint = e.GetPosition(sender as UIElement); - -#if DEBUG - this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); -#endif - } - - private void Resizer_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) - { - this._resizer.ReleaseMouseCapture(); - this._isMouseCaptured = false; - this._resizer.Opacity = 0.25; - } - - private void Resizer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) - { - if (this._isMouseCaptured && this.ContentRoot != null) - { - // If the child window is dragged out of the page, return - if (Application.Current != null && Application.Current.RootVisual != null && - (e.GetPosition(Application.Current.RootVisual).X < 0 || e.GetPosition(Application.Current.RootVisual).Y < 0)) - { - return; - } - -#if DEBUG - this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); -#endif - - Point p = e.GetPosition(this.ContentRoot); - - if ((p.X > this._clickPoint.X) && (p.Y > this._clickPoint.Y)) - { - this.Width = (double)(p.X - (12 - this._clickPoint.X)); - this.Height = (double)(p.Y - (12 - this._clickPoint.Y)); - } - } - } - - private Storyboard GetVisualStateStoryboard(string visualStateGroupName, string visualStateName) - { - foreach (VisualStateGroup g in VisualStateManager.GetVisualStateGroups((FrameworkElement)this.ContentRoot.Parent)) - { - if (g.Name != visualStateGroupName) continue; - foreach (VisualState s in g.States) - { - if (s.Name != visualStateName) continue; - return s.Storyboard; - } - } - return null; - } - - #endregion Methods - } -} \ No newline at end of file
--- a/SilverlightGlimpse/FloatableWindow/FloatableWindow.csproj Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'"> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{D47E6045-91BB-4CD0-942F-FF015F10F7F2}</ProjectGuid> - <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FloatableWindow</RootNamespace> - <AssemblyName>FloatableWindow</AssemblyName> - <TargetFrameworkVersion>v5.0</TargetFrameworkVersion> - <SilverlightApplication>false</SilverlightApplication> - <ValidateXaml>true</ValidateXaml> - <ThrowErrorsInValidation>true</ThrowErrorsInValidation> - <SignAssembly>false</SignAssembly> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> - <FileUpgradeFlags> - </FileUpgradeFlags> - <UpgradeBackupLocation> - </UpgradeBackupLocation> - <OldToolsVersion>4.0</OldToolsVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>Bin\Debug</OutputPath> - <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <RunCodeAnalysis>true</RunCodeAnalysis> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>Bin\Release</OutputPath> - <DefineConstants>TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <ItemGroup> - <Reference Include="System.Windows" /> - <Reference Include="mscorlib" /> - <Reference Include="system" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Net" /> - <Reference Include="System.Windows.Browser" /> - </ItemGroup> - <ItemGroup> - <Compile Include="FloatableWindow.cs" /> - <Compile Include="FloatableWindowAutomationPeer.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Properties\Resources.Designer.cs" /> - </ItemGroup> - <ItemGroup> - <Page Include="themes\generic.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:MarkupCompilePass1</Generator> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="Properties\Resources.resx" /> - </ItemGroup> - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties /> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> -</Project> \ No newline at end of file
--- a/SilverlightGlimpse/FloatableWindow/FloatableWindow.sln Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatableWindow", "FloatableWindow.csproj", "{D47E6045-91BB-4CD0-942F-FF015F10F7F2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D47E6045-91BB-4CD0-942F-FF015F10F7F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D47E6045-91BB-4CD0-942F-FF015F10F7F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D47E6045-91BB-4CD0-942F-FF015F10F7F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D47E6045-91BB-4CD0-942F-FF015F10F7F2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal
--- a/SilverlightGlimpse/FloatableWindow/FloatableWindowAutomationPeer.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,414 +0,0 @@ -// (c) Copyright Microsoft Corporation. -// This source is subject to the Microsoft Public License (Ms-PL). -// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. -// All other rights reserved. - -using System.Windows.Automation.Provider; -using System.Windows.Controls; -using System.Windows.Media; - -namespace System.Windows.Automation.Peers -{ - public class FloatableWindowAutomationPeer : FrameworkElementAutomationPeer, IWindowProvider, ITransformProvider - { - #region Data - - /// <summary> - /// Specifies whether the FloatableWindow is the top most element. - /// </summary> - private bool _isTopMost; - - #endregion Data - - #region Properties - - /// <summary> - /// Gets or sets a value indicating whether the FloatableWindow is the top most element. - /// </summary> - private bool IsTopMostPrivate - { - get - { - return this._isTopMost; - } - set - { - if (this._isTopMost != value) - { - this._isTopMost = value; - this.RaisePropertyChangedEvent(WindowPatternIdentifiers.IsTopmostProperty, !this._isTopMost, this._isTopMost); - } - } - } - - /// <summary> - /// Gets the owning FloatableWindow. - /// </summary> - private FloatableWindow OwningFloatableWindow - { - get - { - return (FloatableWindow)Owner; - } - } - - #endregion Properties - - public FloatableWindowAutomationPeer(FloatableWindow owner) - : base(owner) - { - if (owner == null) - { - throw new ArgumentNullException("owner"); - } - this.RefreshIsTopMostProperty(); - } - - #region AutomationPeer overrides - - /// <summary> - /// Gets the control pattern for this - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />. - /// </summary> - /// <param name="patternInterface"> - /// One of the enumeration values. - /// </param> - /// <returns> - /// The object that implements the pattern interface, or null if the - /// specified pattern interface is not implemented by this peer. - /// </returns> - public override object GetPattern(PatternInterface patternInterface) - { - if (patternInterface == PatternInterface.Transform || patternInterface == PatternInterface.Window) - { - return this; - } - - return base.GetPattern(patternInterface); - } - - /// <summary> - /// Gets the - /// <see cref="T:System.Windows.Automation.Peers.AutomationControlType" /> - /// for the element associated with this - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />. - /// Called by - /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetAutomationControlType" />. - /// </summary> - /// <returns>A value of the enumeration.</returns> - protected override AutomationControlType GetAutomationControlTypeCore() - { - return AutomationControlType.Window; - } - - /// <summary> - /// Gets the name of the class for the object associated with this - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />. - /// Called by - /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetClassName" />. - /// </summary> - /// <returns> - /// A string value that represents the type of the child window. - /// </returns> - protected override string GetClassNameCore() - { - return this.Owner.GetType().Name; - } - - /// <summary> - /// Gets the text label of the - /// <see cref="T:System.Windows.Controls.FloatableWindow" /> that is - /// associated with this - /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />. - /// Called by - /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetName" />. - /// </summary> - /// <returns> - /// The text label of the element that is associated with this - /// automation peer. - /// </returns> - protected override string GetNameCore() - { - string name = base.GetNameCore(); - if (string.IsNullOrEmpty(name)) - { - AutomationPeer labeledBy = GetLabeledByCore(); - if (labeledBy != null) - { - name = labeledBy.GetName(); - } - - if (string.IsNullOrEmpty(name) && this.OwningFloatableWindow.Title != null) - { - name = this.OwningFloatableWindow.Title.ToString(); - } - } - return name; - } - - #endregion AutomationPeer overrides - - #region IWindowProvider - - /// <summary> - /// Gets the interaction state of the window. - /// </summary> - /// <value> - /// The interaction state of the control, as a value of the enumeration. - /// </value> - WindowInteractionState IWindowProvider.InteractionState - { - get - { - return this.OwningFloatableWindow.InteractionState; - } - } - - /// <summary> - /// Gets a value indicating whether the window is modal. - /// </summary> - /// <value> - /// True in all cases. - /// </value> - bool IWindowProvider.IsModal - { - get { return true; } - } - - /// <summary> - /// Gets a value indicating whether the window is the topmost - /// element in the z-order of layout. - /// </summary> - /// <value> - /// True if the window is topmost; otherwise, false. - /// </value> - bool IWindowProvider.IsTopmost - { - get - { - return this.IsTopMostPrivate; - } - } - - /// <summary> - /// Gets a value indicating whether the window can be maximized. - /// </summary> - /// <value>False in all cases.</value> - bool IWindowProvider.Maximizable - { - get { return false; } - } - - /// <summary> - /// Gets a value indicating whether the window can be minimized. - /// </summary> - /// <value>False in all cases.</value> - bool IWindowProvider.Minimizable - { - get { return false; } - } - - /// <summary> - /// Gets the visual state of the window. - /// </summary> - /// <value> - /// <see cref="F:System.Windows.Automation.WindowVisualState.Normal" /> - /// in all cases. - /// </value> - WindowVisualState IWindowProvider.VisualState - { - get - { - return WindowVisualState.Normal; - } - } - - /// <summary> - /// Closes the window. - /// </summary> - void IWindowProvider.Close() - { - this.OwningFloatableWindow.Close(); - } - - /// <summary> - /// Changes the visual state of the window (such as minimizing or - /// maximizing it). - /// </summary> - /// <param name="state"> - /// The visual state of the window to change to, as a value of the - /// enumeration. - /// </param> - void IWindowProvider.SetVisualState(WindowVisualState state) - { - } - - /// <summary> - /// Blocks the calling code for the specified time or until the - /// associated process enters an idle state, whichever completes first. - /// </summary> - /// <param name="milliseconds"> - /// The amount of time, in milliseconds, to wait for the associated - /// process to become idle. - /// </param> - /// <returns> - /// True if the window has entered the idle state; false if the timeout - /// occurred. - /// </returns> - bool IWindowProvider.WaitForInputIdle(int milliseconds) - { - return false; - } - - #endregion IWindowProvider - - #region ITransformProvider - - /// <summary> - /// Moves the control. - /// </summary> - /// <param name="x"> - /// The absolute screen coordinates of the left side of the control. - /// </param> - /// <param name="y"> - /// The absolute screen coordinates of the top of the control. - /// </param> - void ITransformProvider.Move(double x, double y) - { - if (x < 0) - { - x = 0; - } - - if (y < 0) - { - y = 0; - } - - if (x > this.OwningFloatableWindow.Width) - { - x = this.OwningFloatableWindow.Width; - } - - if (y > this.OwningFloatableWindow.Height) - { - y = this.OwningFloatableWindow.Height; - } - - FrameworkElement contentRoot = this.OwningFloatableWindow.ContentRoot; - - if (contentRoot != null) - { - GeneralTransform gt = contentRoot.TransformToVisual(null); - - if (gt != null) - { - Point p = gt.Transform(new Point(0, 0)); - - TransformGroup transformGroup = contentRoot.RenderTransform as TransformGroup; - - if (transformGroup == null) - { - transformGroup = new TransformGroup(); - transformGroup.Children.Add(contentRoot.RenderTransform); - } - - TranslateTransform t = new TranslateTransform(); - t.X = x - p.X; - t.Y = y - p.Y; - - if (transformGroup != null) - { - transformGroup.Children.Add(t); - contentRoot.RenderTransform = transformGroup; - } - } - } - } - - /// <summary> - /// Resizes the control. - /// </summary> - /// <param name="width">The new width of the window, in pixels.</param> - /// <param name="height"> - /// The new height of the window, in pixels. - /// </param> - void ITransformProvider.Resize(double width, double height) - { - } - - /// <summary> - /// Rotates the control. - /// </summary> - /// <param name="degrees"> - /// The number of degrees to rotate the control. A positive number - /// rotates the control clockwise. A negative number rotates the - /// control counterclockwise. - /// </param> - void ITransformProvider.Rotate(double degrees) - { - } - - /// <summary> - /// Gets a value indicating whether the element can be moved. - /// </summary> - /// <value>True in all cases.</value> - bool ITransformProvider.CanMove - { - get { return true; } - } - - /// <summary> - /// Gets a value indicating whether the element can be resized. - /// </summary> - /// <value>False in all cases.</value> - bool ITransformProvider.CanResize - { - get { return false; } - } - - /// <summary> - /// Gets a value indicating whether the element can be rotated. - /// </summary> - /// <value>False in all cases.</value> - bool ITransformProvider.CanRotate - { - get { return false; } - } - - #endregion ITransformProvider - - #region Methods - - /// <summary> - /// Returns if the FloatableWindow is the top most element. - /// </summary> - /// <returns>Bool value.</returns> - private bool GetIsTopMostCore() - { - return !(this.OwningFloatableWindow.InteractionState == WindowInteractionState.BlockedByModalWindow); - } - - /// <summary> - /// Raises PropertyChangedEvent for WindowInteractionStateProperty. - /// </summary> - /// <param name="oldValue">Old WindowInteractionStateProperty.</param> - /// <param name="newValue">New WindowInteractionStateProperty.</param> - internal void RaiseInteractionStatePropertyChangedEvent(WindowInteractionState oldValue, WindowInteractionState newValue) - { - this.RaisePropertyChangedEvent(WindowPatternIdentifiers.WindowInteractionStateProperty, oldValue, newValue); - this.RefreshIsTopMostProperty(); - } - - /// <summary> - /// Updates the IsTopMostPrivate property. - /// </summary> - private void RefreshIsTopMostProperty() - { - this.IsTopMostPrivate = this.GetIsTopMostCore(); - } - - #endregion Methods - } -} -
--- a/SilverlightGlimpse/FloatableWindow/Properties/AssemblyInfo.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; -using System; -using System.Windows.Markup; - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e26dd271-436d-483d-91e2-de61b3ffe0af")] -[assembly: AssemblyTitle("System.Windows.Controls")] -[assembly: AssemblyDescription("FloatableWindow Silverlight Control")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Tim Heuer")] -[assembly: AssemblyProduct("FloatableWindow")] -[assembly: AssemblyCopyright("Licensed under Ms-PL")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en-US")] -[assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.5.0")] -[assembly: AssemblyFileVersion("3.0.40624.4")] -[assembly: CLSCompliant(true)] -[assembly: XmlnsPrefix("clr-namespace:System.Windows.Controls;assembly=FloatableWindow", "windows")] -[assembly: XmlnsDefinitionAttribute("clr-namespace:System.Windows.Controls;assembly=FloatableWindow", "System.Windows.Controls")] \ No newline at end of file
--- a/SilverlightGlimpse/FloatableWindow/Properties/Resources.Designer.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,396 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:2.0.50727.4918 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace System.Windows.Controls.Properties { - using System; - - - /// <summary> - /// A strongly-typed resource class, for looking up localized strings, etc. - /// </summary> - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// <summary> - /// Returns the cached ResourceManager instance used by this class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Windows.Controls.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// <summary> - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot perform operation.. - /// </summary> - internal static string Automation_OperationCannotBePerformed { - get { - return ResourceManager.GetString("Automation_OperationCannotBePerformed", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The SelectedDates collection can be changed only in a multiple selection mode. Use the SelectedDate in a single selection mode.. - /// </summary> - internal static string Calendar_CheckSelectionMode_InvalidOperation { - get { - return ResourceManager.GetString("Calendar_CheckSelectionMode_InvalidOperation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to next button. - /// </summary> - internal static string Calendar_NextButtonName { - get { - return ResourceManager.GetString("Calendar_NextButtonName", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to DisplayMode value is not valid.. - /// </summary> - internal static string Calendar_OnDisplayModePropertyChanged_InvalidValue { - get { - return ResourceManager.GetString("Calendar_OnDisplayModePropertyChanged_InvalidValue", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to FirstDayOfWeek value is not valid.. - /// </summary> - internal static string Calendar_OnFirstDayOfWeekChanged_InvalidValue { - get { - return ResourceManager.GetString("Calendar_OnFirstDayOfWeekChanged_InvalidValue", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The SelectedDate property cannot be set when the selection mode is None.. - /// </summary> - internal static string Calendar_OnSelectedDateChanged_InvalidOperation { - get { - return ResourceManager.GetString("Calendar_OnSelectedDateChanged_InvalidOperation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to SelectedDate value is not valid.. - /// </summary> - internal static string Calendar_OnSelectedDateChanged_InvalidValue { - get { - return ResourceManager.GetString("Calendar_OnSelectedDateChanged_InvalidValue", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to SelectionMode value is not valid.. - /// </summary> - internal static string Calendar_OnSelectionModeChanged_InvalidValue { - get { - return ResourceManager.GetString("Calendar_OnSelectionModeChanged_InvalidValue", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to previous button. - /// </summary> - internal static string Calendar_PreviousButtonName { - get { - return ResourceManager.GetString("Calendar_PreviousButtonName", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Value is not valid.. - /// </summary> - internal static string Calendar_UnSelectableDates { - get { - return ResourceManager.GetString("Calendar_UnSelectableDates", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Blackout Day - {0}. - /// </summary> - internal static string CalendarAutomationPeer_BlackoutDayHelpText { - get { - return ResourceManager.GetString("CalendarAutomationPeer_BlackoutDayHelpText", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to calendar button. - /// </summary> - internal static string CalendarAutomationPeer_CalendarButtonLocalizedControlType { - get { - return ResourceManager.GetString("CalendarAutomationPeer_CalendarButtonLocalizedControlType", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to day button. - /// </summary> - internal static string CalendarAutomationPeer_DayButtonLocalizedControlType { - get { - return ResourceManager.GetString("CalendarAutomationPeer_DayButtonLocalizedControlType", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Decade. - /// </summary> - internal static string CalendarAutomationPeer_DecadeMode { - get { - return ResourceManager.GetString("CalendarAutomationPeer_DecadeMode", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Month. - /// </summary> - internal static string CalendarAutomationPeer_MonthMode { - get { - return ResourceManager.GetString("CalendarAutomationPeer_MonthMode", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Year. - /// </summary> - internal static string CalendarAutomationPeer_YearMode { - get { - return ResourceManager.GetString("CalendarAutomationPeer_YearMode", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to This type of Collection does not support changes to its SourceCollection from a thread different from the Dispatcher thread.. - /// </summary> - internal static string CalendarCollection_MultiThreadedCollectionChangeNotSupported { - get { - return ResourceManager.GetString("CalendarCollection_MultiThreadedCollectionChangeNotSupported", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot call Show() on a ChildWindow that is in the visual tree. ChildWindow should be the top-most element in the .xaml file.. - /// </summary> - internal static string ChildWindow_InvalidOperation { - get { - return ResourceManager.GetString("ChildWindow_InvalidOperation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Show Calendar. - /// </summary> - internal static string DatePicker_DropDownButtonName { - get { - return ResourceManager.GetString("DatePicker_DropDownButtonName", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to DatePickerFormat value is not valid.. - /// </summary> - internal static string DatePicker_OnSelectedDateFormatChanged_InvalidValue { - get { - return ResourceManager.GetString("DatePicker_OnSelectedDateFormatChanged_InvalidValue", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to <{0}>. - /// </summary> - internal static string DatePicker_WatermarkText { - get { - return ResourceManager.GetString("DatePicker_WatermarkText", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to date picker. - /// </summary> - internal static string DatePickerAutomationPeer_LocalizedControlType { - get { - return ResourceManager.GetString("DatePickerAutomationPeer_LocalizedControlType", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot Throw Null Exception. - /// </summary> - internal static string DatePickerDateValidationErrorEventArgs_ThrowException_NoException { - get { - return ResourceManager.GetString("DatePickerDateValidationErrorEventArgs_ThrowException_NoException", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to <enter text here>. - /// </summary> - internal static string DatePickerTextBox_DefaultWatermarkText { - get { - return ResourceManager.GetString("DatePickerTextBox_DefaultWatermarkText", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The template part {0} is not an instance of {1}.. - /// </summary> - internal static string DatePickerTextBox_TemplatePartIsOfIncorrectType { - get { - return ResourceManager.GetString("DatePickerTextBox_TemplatePartIsOfIncorrectType", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to DateTime value is in the wrong format.. - /// </summary> - internal static string DateTimeTypeConverter_FormatException { - get { - return ResourceManager.GetString("DateTimeTypeConverter_FormatException", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to ConstructorParameters cannot be changed because ObjectDataProvider is using a user-assigned ObjectInstance.. - /// </summary> - internal static string ParameterCollection_EnsureCanChangeCollection_IsReadOnly { - get { - return ResourceManager.GetString("ParameterCollection_EnsureCanChangeCollection_IsReadOnly", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The elementName should not be empty.. - /// </summary> - internal static string ResolveElementNameEventArgs_ctor_ElementNameEmpty { - get { - return ResourceManager.GetString("ResolveElementNameEventArgs_ctor_ElementNameEmpty", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to The RoutedPropertyChangingEvent cannot be canceled!. - /// </summary> - internal static string RoutedPropertyChangingEventArgs_CancelSet_InvalidOperation { - get { - return ResourceManager.GetString("RoutedPropertyChangingEventArgs_CancelSet_InvalidOperation", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Unable to cast object of type '{0}' to type 'System.Windows.Controls.TabItem'.. - /// </summary> - internal static string TabControl_InvalidChild { - get { - return ResourceManager.GetString("TabControl_InvalidChild", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to '{0}' is not a valid value for property 'SelectedIndex'. - /// </summary> - internal static string TabControl_InvalidIndex { - get { - return ResourceManager.GetString("TabControl_InvalidIndex", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot set read-only property SelectedItem.. - /// </summary> - internal static string TreeView_OnSelectedItemPropertyChanged_InvalidWrite { - get { - return ResourceManager.GetString("TreeView_OnSelectedItemPropertyChanged_InvalidWrite", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot set read-only property SelectedValue.. - /// </summary> - internal static string TreeView_OnSelectedValuePropertyChanged_InvalidWrite { - get { - return ResourceManager.GetString("TreeView_OnSelectedValuePropertyChanged_InvalidWrite", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot set read-only property HasItems.. - /// </summary> - internal static string TreeViewItem_OnHasItemsPropertyChanged_InvalidWrite { - get { - return ResourceManager.GetString("TreeViewItem_OnHasItemsPropertyChanged_InvalidWrite", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Cannot set read-only property IsSelectionActive.. - /// </summary> - internal static string TreeViewItem_OnIsSelectionActivePropertyChanged_InvalidWrite { - get { - return ResourceManager.GetString("TreeViewItem_OnIsSelectionActivePropertyChanged_InvalidWrite", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to '{0}' is unable to convert '{1}' to '{2}'.. - /// </summary> - internal static string TypeConverters_Convert_CannotConvert { - get { - return ResourceManager.GetString("TypeConverters_Convert_CannotConvert", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to '{0}' cannot convert from '{1}'.. - /// </summary> - internal static string TypeConverters_ConvertFrom_CannotConvertFromType { - get { - return ResourceManager.GetString("TypeConverters_ConvertFrom_CannotConvertFromType", resourceCulture); - } - } - } -}
--- a/SilverlightGlimpse/FloatableWindow/Properties/Resources.resx Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <data name="Automation_OperationCannotBePerformed" xml:space="preserve"> - <value>Cannot perform operation.</value> - <comment>Exception thrown by automation peers.</comment> - </data> - <data name="ChildWindow_InvalidOperation" xml:space="preserve"> - <value>Cannot call Show() on a ChildWindow that is in the visual tree. ChildWindow should be the top-most element in the .xaml file.</value> - <comment>Exception thrown when the ChildWindow is in the visual tree and Show() is called on it.</comment> - </data> -</root> \ No newline at end of file
--- a/SilverlightGlimpse/FloatableWindow/themes/generic.xaml Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,352 +0,0 @@ -<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:controls="clr-namespace:System.Windows.Controls" - xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"> - - <Style TargetType="controls:FloatableWindow"> - <Setter Property="IsTabStop" Value="false" /> - <Setter Property="TabNavigation" Value="Cycle" /> - <Setter Property="HorizontalAlignment" Value="Center" /> - <Setter Property="VerticalAlignment" Value="Center" /> - <Setter Property="HorizontalContentAlignment" Value="Stretch" /> - <Setter Property="VerticalContentAlignment" Value="Stretch" /> - <Setter Property="BorderThickness" Value="1" /> - <Setter Property="BorderBrush"> - <Setter.Value> - <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> - <GradientStop Offset="0" Color="#FFA3AEB9" /> - <GradientStop Offset="0.375" Color="#FF8399A9" /> - <GradientStop Offset="0.375" Color="#FF718597" /> - <GradientStop Offset="1" Color="#FF617584" /> - </LinearGradientBrush> - </Setter.Value> - </Setter> - <Setter Property="OverlayBrush"> - <Setter.Value> - <SolidColorBrush Color="#7F000000" /> - </Setter.Value> - </Setter> - <Setter Property="OverlayOpacity" Value="1" /> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="controls:FloatableWindow"> - <Grid x:Name="Root"> - <Grid.Resources> - <Style x:Key="ButtonStyle" TargetType="Button"> - <Setter Property="Background" Value="#FF1F3B53" /> - <Setter Property="Foreground" Value="#FF000000" /> - <Setter Property="Padding" Value="3" /> - <Setter Property="BorderThickness" Value="1" /> - <Setter Property="BorderBrush"> - <Setter.Value> - <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> - <GradientStop Offset="0" Color="#FFA3AEB9" /> - <GradientStop Offset="0.375" Color="#FF8399A9" /> - <GradientStop Offset="0.375" Color="#FF718597" /> - <GradientStop Offset="1" Color="#FF617584" /> - </LinearGradientBrush> - </Setter.Value> - </Setter> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Grid x:Name="grid" - Width="15" - Height="14" - HorizontalAlignment="Center" - VerticalAlignment="Center" - Background="#02FFFFFF"> - <vsm:VisualStateManager.VisualStateGroups> - <vsm:VisualStateGroup x:Name="CommonStates"> - <vsm:VisualState x:Name="Normal" /> - <vsm:VisualState x:Name="MouseOver"> - <Storyboard> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz2" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz1" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz0" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - <DoubleAnimation Duration="0" - Storyboard.TargetName="X" - Storyboard.TargetProperty="Opacity" - To="0.95" /> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Pressed"> - <Storyboard> - <DoubleAnimation Duration="0" - Storyboard.TargetName="X" - Storyboard.TargetProperty="Opacity" - To="0.85" /> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz2" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz1" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz0" Storyboard.TargetProperty="Visibility"> - <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> - </ObjectAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Disabled"> - <Storyboard> - <DoubleAnimation Duration="0" - Storyboard.TargetName="X" - Storyboard.TargetProperty="Opacity" - To="0.5" /> - </Storyboard> - </vsm:VisualState> - </vsm:VisualStateGroup> - </vsm:VisualStateManager.VisualStateGroups> - <Path x:Name="X_Fuzz2" - Width="9" - Height="8" - Margin="0,-1,0,0" - HorizontalAlignment="Center" - VerticalAlignment="Center" - Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" - Fill="#14C51900" - Opacity="1" - RenderTransformOrigin="0.5,0.5" - Stretch="Fill" - Stroke="#14C51900" - Visibility="Collapsed"> - <Path.RenderTransform> - <TransformGroup> - <ScaleTransform ScaleX="1.3" ScaleY="1.3" /> - </TransformGroup> - </Path.RenderTransform> - </Path> - <Path x:Name="X_Fuzz1" - Width="9" - Height="8" - Margin="0,-1,0,0" - HorizontalAlignment="Center" - VerticalAlignment="Center" - Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" - Fill="#1EC51900" - Opacity="1" - RenderTransformOrigin="0.5,0.5" - Stretch="Fill" - Stroke="#1EC51900" - Visibility="Collapsed"> - <Path.RenderTransform> - <TransformGroup> - <ScaleTransform ScaleX="1.1" ScaleY="1.1" /> - </TransformGroup> - </Path.RenderTransform> - </Path> - <Path x:Name="X_Fuzz0" - Width="9" - Height="8" - Margin="0,-1,0,0" - HorizontalAlignment="Center" - VerticalAlignment="Center" - Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" - Fill="#FFC51900" - Opacity="1" - Stretch="Fill" - Stroke="#FFC51900" - Visibility="Collapsed" /> - <Path x:Name="X" - Width="9" - Height="8" - Margin="0,-1,0,0" - HorizontalAlignment="Center" - VerticalAlignment="Center" - Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" - Fill="#FFFFFFFF" - Opacity="0.7" - Stretch="Fill"> - <Path.Stroke> - <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> - <GradientStop Offset="1" Color="#FF313131" /> - <GradientStop Offset="0" Color="#FF8E9092" /> - </LinearGradientBrush> - </Path.Stroke> - </Path> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - </Grid.Resources> - <vsm:VisualStateManager.VisualStateGroups> - <vsm:VisualStateGroup x:Name="WindowStates"> - <vsm:VisualState x:Name="Open"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="Overlay" - Storyboard.TargetProperty="Opacity"> - <EasingDoubleKeyFrame KeyTime="0" Value="0" /> - <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1" /> - </DoubleAnimationUsingKeyFrames> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="ContentRoot" - Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX"> - <SplineDoubleKeyFrame KeyTime="0" Value="0" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1" /> - <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" - KeyTime="00:00:00.45" - Value="1.05" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1" /> - </DoubleAnimationUsingKeyFrames> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="ContentRoot" - Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY"> - <SplineDoubleKeyFrame KeyTime="0" Value="0" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1" /> - <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" - KeyTime="00:00:00.45" - Value="1.05" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1" /> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Closed"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="Overlay" - Storyboard.TargetProperty="Opacity"> - <EasingDoubleKeyFrame KeyTime="0" Value="1" /> - <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0" /> - </DoubleAnimationUsingKeyFrames> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="ContentRoot" - Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX"> - <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0" /> - </DoubleAnimationUsingKeyFrames> - <DoubleAnimationUsingKeyFrames BeginTime="0" - Storyboard.TargetName="ContentRoot" - Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY"> - <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05" /> - <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0" /> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - </vsm:VisualStateGroup> - </vsm:VisualStateManager.VisualStateGroups> - <Grid x:Name="Overlay" - Margin="0" - HorizontalAlignment="Stretch" - VerticalAlignment="Top" - Background="{TemplateBinding OverlayBrush}" - Opacity="{TemplateBinding OverlayOpacity}" /> - <Grid x:Name="ContentRoot" - Width="{TemplateBinding Width}" - Height="{TemplateBinding Height}" - HorizontalAlignment="{TemplateBinding HorizontalAlignment}" - VerticalAlignment="{TemplateBinding VerticalAlignment}" - RenderTransformOrigin="0.5,0.5"> - <Grid.RenderTransform> - <TransformGroup> - <ScaleTransform /> - <SkewTransform /> - <RotateTransform /> - <TranslateTransform /> - </TransformGroup> - </Grid.RenderTransform> - <Border Margin="-1" - HorizontalAlignment="Stretch" - VerticalAlignment="Stretch" - Background="#14000000" - BorderBrush="#14000000" - BorderThickness="1" - CornerRadius="2" /> - <Border Margin="-2" - HorizontalAlignment="Stretch" - VerticalAlignment="Stretch" - Background="#0F000000" - BorderBrush="#0F000000" - BorderThickness="1" - CornerRadius="2.25" /> - <Border Margin="-3" - HorizontalAlignment="Stretch" - VerticalAlignment="Stretch" - Background="#0C000000" - BorderBrush="#0C000000" - BorderThickness="1" - CornerRadius="2.5" /> - <Border Margin="-4" - HorizontalAlignment="Stretch" - VerticalAlignment="Stretch" - Background="#0A000000" - BorderBrush="#0A000000" - BorderThickness="1" - CornerRadius="2.75" /> - <Border Background="#FFFFFFFF" - BorderBrush="{TemplateBinding BorderBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="2"> - <Border Margin="1" CornerRadius="1.5"> - <Border.Background> - <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> - <GradientStop Offset="1" Color="#FFE5E8EB" /> - <GradientStop Offset="0" Color="#FFF6F8F9" /> - </LinearGradientBrush> - </Border.Background> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition /> - </Grid.RowDefinitions> - <Border x:Name="Chrome" - Width="Auto" - BorderBrush="#FFFFFFFF" - BorderThickness="0,0,0,1"> - <Border.Background> - <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,0.528"> - <GradientStop Offset="1" Color="#FFE5E8EB" /> - <GradientStop Offset="0" Color="#FFFEFEFE" /> - </LinearGradientBrush> - </Border.Background> - <Grid Width="Auto" Height="Auto"> - <Grid.ColumnDefinitions> - <ColumnDefinition /> - <ColumnDefinition Width="30" /> - </Grid.ColumnDefinitions> - <ContentControl Margin="6,0,6,0" - HorizontalAlignment="Stretch" - VerticalAlignment="Center" - Content="{TemplateBinding Title}" - FontWeight="Bold" - IsTabStop="False" /> - <Button x:Name="CloseButton" - Grid.Column="1" - Width="15" - Height="14" - HorizontalAlignment="Center" - VerticalAlignment="Center" - IsTabStop="False" - Style="{StaticResource ButtonStyle}" /> - </Grid> - </Border> - <Border Grid.Row="1" - Margin="7" - Background="{TemplateBinding Background}"> - <ContentPresenter x:Name="ContentPresenter" - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" - VerticalAlignment="{TemplateBinding VerticalContentAlignment}" - Content="{TemplateBinding Content}" - ContentTemplate="{TemplateBinding ContentTemplate}" /> - </Border> - </Grid> - </Border> - </Border> - </Grid> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> -</ResourceDictionary> \ No newline at end of file
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/App.xaml Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -<Application x:Class="SilverlightGlimpse.Test.App" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> -</Application>
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/App.xaml.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using System; -using System.Windows; -using SilverlightGlimpse.Services; - -namespace SilverlightGlimpse.Test -{ - public partial class App : Application - { - public App() - { - Startup += Application_Startup; - Exit += Application_Exit; - UnhandledException += Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - var appName = "Silverlight Glimpse"; - try - { - RootVisual = new MainPage(); - Glimpse.Service.Load(this, appName); - } - catch (Exception ex) - { - Glimpse.Service.DisplayLoadFailure(this, ex, appName); - } - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) - { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - //TODO: log here - } - } - } -} \ No newline at end of file
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -<UserControl x:Class="SilverlightGlimpse.Test.MainPage" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="300" - d:DesignWidth="400" - mc:Ignorable="d"> - - <Grid x:Name="LayoutRoot" Background="White"> - <Grid.RowDefinitions> - <RowDefinition Height="300" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - - <ListBox x:Name="listbox1"> - <ListBox.ItemTemplate> - <DataTemplate> - <Grid x:Name="backgroundGrid" - Width="40" - Height="40"> - <Rectangle Fill="Orange" /> - <TextBlock x:Name="LabelForIdProperty" - HorizontalAlignment="Center" - FontSize="24" - Foreground="White" - Text="{Binding IncorrectPathName}" /> - </Grid> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - - <Button x:Name="btnThrowException" - Grid.Row="1" - Click="btnThrowException_Click" - Content="Throw Exception" /> - - </Grid> -</UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -using System.Windows.Navigation; - -namespace SilverlightGlimpse.Test -{ - public partial class MainPage - { - public MainPage() - { - InitializeComponent(); - // uncomment this exception to view exception on startup - //ThrowNestedException(); - - var list = new List<object>(5) - { - new Person { Id = 1 , Name = "Steve"}, - new Person { Id = 2 , Name = "Dave"}, - new Person { Id = 3 , Name = "Bob"}, - new Person { Id = 4 , Name = "Rich"}, - new Person { Id = 5 , Name = "Clare"} - }; - - listbox1.ItemsSource = list; - } - - private void ThrowNestedException() - { - throw new Exception("Oh dear we've hit an exception!", - new Exception("This is an inner exception")); - } - - private void btnThrowException_Click(object sender, RoutedEventArgs e) - { - ThrowNestedException(); - } - } - - public class Person - { - public int Id { get; set; } - public string Name { get; set; } - } -}
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/Properties/AppManifest.xml Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" -> - <Deployment.Parts> - </Deployment.Parts> -</Deployment>
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/Properties/AssemblyInfo.cs Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SilverlightGlimpse.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SilverlightGlimpse.Test")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("416aacbe-6a1b-495f-9d5e-8f975d2e3f58")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")]
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/SilverlightGlimpse.Test.csproj Mon Apr 23 23:07:23 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{212DBD25-6C98-45EB-9974-51D04D8B6549}</ProjectGuid> - <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>SilverlightGlimpse.Test</RootNamespace> - <AssemblyName>SilverlightGlimpse.Test</AssemblyName> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v5.0</TargetFrameworkVersion> - <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> - <SilverlightApplication>true</SilverlightApplication> - <SupportedCultures> - </SupportedCultures> - <XapOutputs>true</XapOutputs> - <GenerateSilverlightManifest>true</GenerateSilverlightManifest> - <XapFilename>SilverlightGlimpse.Test.xap</XapFilename> - <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> - <SilverlightAppEntry>SilverlightGlimpse.Test.App</SilverlightAppEntry> - <TestPageFileName>SilverlightGlimpse.TestTestPage.html</TestPageFileName> - <CreateTestPage>true</CreateTestPage> - <ValidateXaml>true</ValidateXaml> - <EnableOutOfBrowser>false</EnableOutOfBrowser> - <OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile> - <UsePlatformExtensions>false</UsePlatformExtensions> - <ThrowErrorsInValidation>true</ThrowErrorsInValidation> - <LinkedServerProject> - </LinkedServerProject> - <Utf8Output>true</Utf8Output> - <ExpressionBlendVersion>4.1.20402.0</ExpressionBlendVersion> - </PropertyGroup> - <!-- This property group is only here to support building this project using the - MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs - to set the TargetFrameworkVersion to v3.5 --> - <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'"> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>Bin\Debug</OutputPath> - <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>Bin\Release</OutputPath> - <DefineConstants>TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="mscorlib" /> - <Reference Include="System.Windows" /> - <Reference Include="system" /> - <Reference Include="System.Core" /> - <Reference Include="System.Windows.Controls, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> - <Reference Include="System.Windows.Controls.Navigation, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Windows.Browser" /> - </ItemGroup> - <ItemGroup> - <Compile Include="App.xaml.cs"> - <DependentUpon>App.xaml</DependentUpon> - </Compile> - <Compile Include="MainPage.xaml.cs"> - <DependentUpon>MainPage.xaml</DependentUpon> - </Compile> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ApplicationDefinition Include="App.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </ApplicationDefinition> - </ItemGroup> - <ItemGroup> - <None Include="Properties\AppManifest.xml" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\SilverlightGlimpse\SilverlightGlimpse.csproj"> - <Project>{BB51026B-2864-4389-AACA-0BBDF1926E46}</Project> - <Name>SilverlightGlimpse</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <WCFMetadata Include="Service References\" /> - </ItemGroup> - <ItemGroup> - <Page Include="MainPage.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - </ItemGroup> - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties /> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> - <Import Project="$(MSBuildExtensionsPath)\Microsoft\Expression\Blend\Silverlight\v5.0\Microsoft.Expression.Blend.Silverlight.targets" /> -</Project> \ No newline at end of file