using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Tango.FSE.Common.WindowsManager
{
public static class WindowsManagerHelper
{
#region IsDetached
///
/// Determines whether the element is currently attached.
///
public static readonly DependencyProperty IsDetachedProperty =
DependencyProperty.RegisterAttached("IsDetached",
typeof(bool), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(false));
///
/// Sets the IsDetached attached property.
///
/// The element.
/// if set to true [value].
public static void SetIsDetached(FrameworkElement element, bool value)
{
element.SetValue(IsDetachedProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static bool GetIsDetached(FrameworkElement element)
{
return (bool)element.GetValue(IsDetachedProperty);
}
#endregion
#region WindowTitle
///
/// The detached element window title.
///
public static readonly DependencyProperty WindowTitleProperty =
DependencyProperty.RegisterAttached("WindowTitle",
typeof(String), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(null));
///
/// Sets the WindowTitle attached property.
///
/// The element.
/// if set to true [value].
public static void SetWindowTitle(FrameworkElement element, String value)
{
element.SetValue(WindowTitleProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static String GetWindowTitle(FrameworkElement element)
{
return (String)element.GetValue(WindowTitleProperty);
}
#endregion
#region StartWidth
///
/// The detached element window title.
///
public static readonly DependencyProperty StartWidthProperty =
DependencyProperty.RegisterAttached("StartWidth",
typeof(double?), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(null));
///
/// Sets the StartWidth attached property.
///
/// The element.
/// if set to true [value].
public static void SetStartWidth(FrameworkElement element, double? value)
{
element.SetValue(StartWidthProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static double? GetStartWidth(FrameworkElement element)
{
return (double?)element.GetValue(StartWidthProperty);
}
#endregion
#region StartHeight
///
/// The detached element window title.
///
public static readonly DependencyProperty StartHeightProperty =
DependencyProperty.RegisterAttached("StartHeight",
typeof(double?), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(null));
///
/// Sets the StartHeight attached property.
///
/// The element.
/// if set to true [value].
public static void SetStartHeight(FrameworkElement element, double? value)
{
element.SetValue(StartHeightProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static double? GetStartHeight(FrameworkElement element)
{
return (double?)element.GetValue(StartHeightProperty);
}
#endregion
#region MinWidth
///
/// The detached element window title.
///
public static readonly DependencyProperty MinWidthProperty =
DependencyProperty.RegisterAttached("MinWidth",
typeof(double?), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(null));
///
/// Sets the MinWidth attached property.
///
/// The element.
/// if set to true [value].
public static void SetMinWidth(FrameworkElement element, double? value)
{
element.SetValue(MinWidthProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static double? GetMinWidth(FrameworkElement element)
{
return (double?)element.GetValue(MinWidthProperty);
}
#endregion
#region MinHeight
///
/// The detached element window title.
///
public static readonly DependencyProperty MinHeightProperty =
DependencyProperty.RegisterAttached("MinHeight",
typeof(double?), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(null));
///
/// Sets the MinHeight attached property.
///
/// The element.
/// if set to true [value].
public static void SetMinHeight(FrameworkElement element, double? value)
{
element.SetValue(MinHeightProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static double? GetMinHeight(FrameworkElement element)
{
return (double?)element.GetValue(MinHeightProperty);
}
#endregion
#region LockAspectRatio
///
/// Determines whether the element is currently attached.
///
public static readonly DependencyProperty LockAspectRatioProperty =
DependencyProperty.RegisterAttached("LockAspectRatio",
typeof(bool), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(false));
///
/// Sets the LockAspectRatio attached property.
///
/// The element.
/// if set to true [value].
public static void SetLockAspectRatio(FrameworkElement element, bool value)
{
element.SetValue(LockAspectRatioProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static bool GetLockAspectRatio(FrameworkElement element)
{
return (bool)element.GetValue(LockAspectRatioProperty);
}
#endregion
#region PreservePlaceHolder
///
/// Determines whether the element is currently attached.
///
public static readonly DependencyProperty PreservePlaceHolderProperty =
DependencyProperty.RegisterAttached("PreservePlaceHolder",
typeof(bool), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(false));
///
/// Sets the PreservePlaceHolder attached property.
///
/// The element.
/// if set to true [value].
public static void SetPreservePlaceHolder(FrameworkElement element, bool value)
{
element.SetValue(PreservePlaceHolderProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static bool GetPreservePlaceHolder(FrameworkElement element)
{
return (bool)element.GetValue(PreservePlaceHolderProperty);
}
#endregion
#region DisableMaximize
///
/// Determines whether the element is currently attached.
///
public static readonly DependencyProperty DisableMaximizeProperty =
DependencyProperty.RegisterAttached("DisableMaximize",
typeof(bool), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(false));
///
/// Sets the DisableMaximize attached property.
///
/// The element.
/// if set to true [value].
public static void SetDisableMaximize(FrameworkElement element, bool value)
{
element.SetValue(DisableMaximizeProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static bool GetDisableMaximize(FrameworkElement element)
{
return (bool)element.GetValue(DisableMaximizeProperty);
}
#endregion
#region DisableResolutionServiceInjection
///
/// Determines whether the element is currently attached.
///
public static readonly DependencyProperty DisableResolutionServiceInjectionProperty =
DependencyProperty.RegisterAttached("DisableResolutionServiceInjection",
typeof(bool), typeof(WindowsManagerHelper),
new FrameworkPropertyMetadata(false));
///
/// Sets the DisableResolutionServiceInjection attached property.
///
/// The element.
/// if set to true [value].
public static void SetDisableResolutionServiceInjection(FrameworkElement element, bool value)
{
element.SetValue(DisableResolutionServiceInjectionProperty, value);
}
///
/// Gets the is dragging attached property.
///
/// The element.
///
public static bool GetDisableResolutionServiceInjection(FrameworkElement element)
{
return (bool)element.GetValue(DisableResolutionServiceInjectionProperty);
}
#endregion
#region Detached Event
///
/// Occurs when a successful Detached has occurred.
///
public static readonly RoutedEvent DetachedEvent =
EventManager.RegisterRoutedEvent("Detached",
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof(WindowsManagerHelper));
///
/// Adds the Detached event handler.
///
/// The o.
/// The handler.
public static void AddDetachedHandler(DependencyObject o, RoutedEventHandler handler)
{
((UIElement)o).AddHandler(DetachedEvent, handler);
}
///
/// Removes the Detached event handler.
///
/// The o.
/// The handler.
public static void RemoveDetachedHandler(DependencyObject o, RoutedEventHandler handler)
{
((UIElement)o).RemoveHandler(DetachedEvent, handler);
}
#endregion
#region Attached Event
///
/// Occurs when a successful Attached has occurred.
///
public static readonly RoutedEvent AttachedEvent =
EventManager.RegisterRoutedEvent("Attached",
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof(WindowsManagerHelper));
///
/// Adds the Attached event handler.
///
/// The o.
/// The handler.
public static void AddAttachedHandler(DependencyObject o, RoutedEventHandler handler)
{
((UIElement)o).AddHandler(AttachedEvent, handler);
}
///
/// Removes the Attached event handler.
///
/// The o.
/// The handler.
public static void RemoveAttachedHandler(DependencyObject o, RoutedEventHandler handler)
{
((UIElement)o).RemoveHandler(AttachedEvent, handler);
}
#endregion
}
}