Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2243 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
5 changed files with 191 additions and 18 deletions
@ -0,0 +1,139 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using ICSharpCode.WpfDesign.Adorners; |
||||||
|
using ICSharpCode.WpfDesign.Extensions; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
namespace ICSharpCode.WpfDesign.Designer.Controls |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// A custom control that imitates the properties of <see cref="Window"/>, but is not a top-level control.
|
||||||
|
/// </summary>
|
||||||
|
public class WindowClone : ContentControl |
||||||
|
{ |
||||||
|
static WindowClone() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(typeof(WindowClone))); |
||||||
|
|
||||||
|
Control.IsTabStopProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(false)); |
||||||
|
KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); |
||||||
|
KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); |
||||||
|
KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); |
||||||
|
FocusManager.IsFocusScopeProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(true)); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
public bool AllowsTransparency { |
||||||
|
get { return (bool)GetValue(Window.AllowsTransparencyProperty); } |
||||||
|
set { SetValue(Window.AllowsTransparencyProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the icon to use.
|
||||||
|
/// </summary>
|
||||||
|
public ImageSource Icon { |
||||||
|
get { return (ImageSource)GetValue(Window.IconProperty); } |
||||||
|
set { SetValue(Window.IconProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
[TypeConverter(typeof(LengthConverter))] |
||||||
|
public double Left { |
||||||
|
get { return (double)GetValue(Window.LeftProperty); } |
||||||
|
set { SetValue(Window.LeftProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the resize mode.
|
||||||
|
/// </summary>
|
||||||
|
public ResizeMode ResizeMode { |
||||||
|
get { return (ResizeMode)GetValue(Window.ResizeModeProperty); } |
||||||
|
set { SetValue(Window.ResizeModeProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowInTaskbar { |
||||||
|
get { return (bool)GetValue(Window.ShowInTaskbarProperty); } |
||||||
|
set { SetValue(Window.ShowInTaskbarProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value that specifies whether a window will automatically size itself to fit the size of its content.
|
||||||
|
/// </summary>
|
||||||
|
public SizeToContent SizeToContent { |
||||||
|
get { return (SizeToContent)GetValue(Window.SizeToContentProperty); } |
||||||
|
set { SetValue(Window.SizeToContentProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The title to display in the Window's title bar.
|
||||||
|
/// </summary>
|
||||||
|
public string Title { |
||||||
|
get { return (string)GetValue(Window.TitleProperty); } |
||||||
|
set { SetValue(Window.TitleProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
[TypeConverter(typeof(LengthConverter))] |
||||||
|
public double Top { |
||||||
|
get { return (double)GetValue(Window.TopProperty); } |
||||||
|
set { SetValue(Window.TopProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
public bool Topmost { |
||||||
|
get { return (bool)GetValue(Window.TopmostProperty); } |
||||||
|
set { SetValue(Window.TopmostProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This property has no effect. (for compatibility with <see cref="Window"/> only).
|
||||||
|
/// </summary>
|
||||||
|
public WindowStyle WindowStyle { |
||||||
|
get { return (WindowStyle)GetValue(Window.WindowStyleProperty); } |
||||||
|
set { SetValue(Window.WindowStyleProperty, value); } |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="CustomInstanceFactory"/> for <see cref="Window"/>.
|
||||||
|
/// </summary>
|
||||||
|
[ExtensionFor(typeof(Window))] |
||||||
|
public class WindowCloneExtension : CustomInstanceFactory |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Used to create instances of <see cref="WindowClone"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override object CreateInstance(Type type, params object[] arguments) |
||||||
|
{ |
||||||
|
Debug.Assert(arguments.Length == 0); |
||||||
|
Debug.Assert(type == typeof(Window)); |
||||||
|
return new WindowClone(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue