private float borderHeight = 0;
private int screenWidth = 0;
private int screenHeight = 0;
+
+ // for config
+ private Size2D minSize = null;
+ private Size2D maxSize = null;
+ private BorderResizePolicyType borderResizePolicy = BorderResizePolicyType.Free;
#endregion //Fields
#region Constructors
#endregion //Indexers
#region Methods
+
+ /// <summary>
+ /// Update BorderProperty
+ /// </summary>
+ internal void UpdateProperty()
+ {
+ if (borderInterface != null)
+ {
+ if (minSize != borderInterface.MinSize)
+ {
+ using Size2D mimimumSize = new Size2D(borderInterface.MinSize.Width, borderInterface.MinSize.Height + (int)borderHeight);
+ SetMimimumSize(mimimumSize);
+ minSize = borderInterface.MinSize;
+ }
+ if (maxSize != borderInterface.MaxSize)
+ {
+ using Size2D maximumSize = new Size2D(borderInterface.MaxSize.Width, borderInterface.MaxSize.Height + (int)borderHeight);
+ SetMaximumSize(maximumSize);
+ maxSize = borderInterface.MaxSize;
+ }
+ if (borderResizePolicy != borderInterface.ResizePolicy)
+ {
+ AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "0");
+ borderResizePolicy = borderInterface.ResizePolicy;
+ if (borderResizePolicy == BorderResizePolicyType.KeepRatio)
+ {
+ AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "1");
+ }
+ }
+ }
+ }
/// <summary>
/// Called when the border is closed.
/// If the delegate is declared, the delegate is called, otherwise window is destroyed.
}
if (borderInterface.MaxSize != null)
{
- using Size2D maximuSize = new Size2D(borderInterface.MaxSize.Width, borderInterface.MaxSize.Height + (int)borderHeight);
- SetMaximumSize(maximuSize);
+ using Size2D maximumSize = new Size2D(borderInterface.MaxSize.Width, borderInterface.MaxSize.Height + (int)borderHeight);
+ SetMaximumSize(maximumSize);
}
// When running the app for the first time, if it runs in full size, do Maximize(true).
realWindowSize.Width >= screenWidth && realWindowSize.Height >= screenHeight &&
IsMaximized() == false)
{
- WindowSize -= new Size2D((int)borderInterface.BorderLineThickness * 2, (int)(borderHeight + borderInterface.BorderLineThickness * 2));
Maximize(true);
borderInterface.OnMaximize(true);
+ ResizedEventArgs e = new ResizedEventArgs();
+ e.WindowSize = WindowSize;
+ OnBorderWindowResized(this, e);
}
else
{
private CurrentGesture currentGesture = CurrentGesture.None;
private bool disposed = false;
+
+ private Size2D minSize;
+ private Size2D maxSize;
+ private Window.BorderResizePolicyType resizePolicy;
#endregion //Fields
#region Events
/// The minimum size by which the window will small.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Size2D MinSize {get; set;}
+ public Size2D MinSize
+ {
+ get
+ {
+ return minSize;
+ }
+ set
+ {
+ minSize = value;
+ BorderWindow?.UpdateProperty();
+ }
+ }
/// <summary>
/// The maximum size by which the window will big.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Size2D MaxSize {get; set;}
+ public Size2D MaxSize
+ {
+ get
+ {
+ return maxSize;
+ }
+ set
+ {
+ maxSize = value;
+ BorderWindow?.UpdateProperty();
+ }
+ }
/// <summary>
/// The window with borders added.
/// Default value is BorderResizePolicyType.Free;
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Window.BorderResizePolicyType ResizePolicy {get; set;}
+ public Window.BorderResizePolicyType ResizePolicy
+ {
+ get
+ {
+ return resizePolicy;
+ }
+ set
+ {
+ resizePolicy = value;
+ BorderWindow?.UpdateProperty();
+ }
+ }
/// <summary>