统计页面增加 tab页面 天,周,月 统计
This commit is contained in:
1 parent
355a0f6be7
commit
872dc70094
10 files changed
+1222
-19
No files matched your search
@@ -8,7 +8,7 @@
|
||||
Title="{Binding Title}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#FFFFFF"
|
||||
Background="#FFFFFF"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Window.Resources>
|
||||
<Style x:Key="DialogWindowStyle" TargetType="Window">
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
|
||||
|
||||
|
||||
@@ -15,25 +18,26 @@ namespace _29WxOrderWpf.Common
|
||||
{
|
||||
private readonly Style dialogWindowStyle;
|
||||
private bool isConstructorSuccessful = false;
|
||||
private UserControl _content;
|
||||
public DialogWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Owner = Application.Current.MainWindow;
|
||||
isConstructorSuccessful = true;
|
||||
dialogWindowStyle = (Style)TryFindResource("DialogWindowStyle");
|
||||
|
||||
Loaded += DialogWindow_Loaded;
|
||||
}
|
||||
private void DialogWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Loaded -= DialogWindow_Loaded;
|
||||
|
||||
|
||||
}
|
||||
protected override void OnContentChanged(object oldContent, object newContent)
|
||||
{
|
||||
this.Style = dialogWindowStyle;
|
||||
if (newContent is System.Windows.Controls.UserControl control)
|
||||
{
|
||||
_content = control;
|
||||
|
||||
Setter widthSetter = this.Style.Setters.OfType<Setter>().FirstOrDefault(a => a.Property == WidthProperty);
|
||||
if (widthSetter == null)
|
||||
@@ -70,7 +74,11 @@ namespace _29WxOrderWpf.Common
|
||||
{
|
||||
this.ResizeMode = resizeExt;
|
||||
}
|
||||
|
||||
WindowStyle wstyleExt = DialogWindowProperty.GetWindowStyle(control);
|
||||
if (wstyleExt != WindowStyle.SingleBorderWindow)
|
||||
{
|
||||
this.WindowStyle = wstyleExt;
|
||||
}
|
||||
}
|
||||
base.OnContentChanged(oldContent, newContent);
|
||||
}
|
||||
@@ -87,5 +95,31 @@ namespace _29WxOrderWpf.Common
|
||||
}
|
||||
base.OnStyleChanged(oldStyle, newStyle);
|
||||
}
|
||||
|
||||
|
||||
#region ShowMiniButton
|
||||
private const int GWL_STYLE = -16;
|
||||
private const int WS_MINIMIZEBOX = 0x00020000;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
|
||||
int style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
style &= ~WS_MINIMIZEBOX;
|
||||
if (DialogWindowProperty.GetShowMinButton(this._content) == false)
|
||||
{
|
||||
SetWindowLong(hwnd, GWL_STYLE, style);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,18 @@ namespace _29WxOrderWpf.Common
|
||||
public static ResizeMode GetResizeMode(DependencyObject element)
|
||||
=> (ResizeMode)element.GetValue(ResizeModeProperty);
|
||||
|
||||
public static readonly DependencyProperty WindowStyleProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"WindowStyle",
|
||||
typeof(WindowStyle),
|
||||
typeof(DialogWindowProperty),
|
||||
new PropertyMetadata(WindowStyle.SingleBorderWindow));
|
||||
|
||||
public static void SetWindowStyle(DependencyObject element, WindowStyle value)
|
||||
=> element.SetValue(WindowStyleProperty, value);
|
||||
|
||||
public static WindowStyle GetWindowStyle(DependencyObject element)
|
||||
=> (WindowStyle)element.GetValue(WindowStyleProperty);
|
||||
|
||||
|
||||
public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached(
|
||||
@@ -46,5 +58,47 @@ namespace _29WxOrderWpf.Common
|
||||
=> (double)element.GetValue(HeightProperty);
|
||||
|
||||
|
||||
// 1. ShowMinButton 附加属性
|
||||
public static readonly DependencyProperty ShowMinButtonProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"ShowMinButton",
|
||||
typeof(bool),
|
||||
typeof(DialogWindowProperty),
|
||||
new PropertyMetadata(true));
|
||||
|
||||
public static void SetShowMinButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowMinButtonProperty, value);
|
||||
|
||||
public static bool GetShowMinButton(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowMinButtonProperty);
|
||||
|
||||
// 2. ShowMaxButton 附加属性
|
||||
public static readonly DependencyProperty ShowMaxButtonProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"ShowMaxButton",
|
||||
typeof(bool),
|
||||
typeof(DialogWindowProperty),
|
||||
new PropertyMetadata(true));
|
||||
|
||||
public static void SetShowMaxButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowMaxButtonProperty, value);
|
||||
|
||||
public static bool GetShowMaxButton(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowMaxButtonProperty);
|
||||
|
||||
// 3. ShowCloseButton 附加属性
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"ShowCloseButton",
|
||||
typeof(bool),
|
||||
typeof(DialogWindowProperty),
|
||||
new PropertyMetadata(true));
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, value);
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user