统计页面增加 tab页面 天,周,月 统计
This commit is contained in:
1 parent
355a0f6be7
commit
872dc70094
10 files changed
+1222
-19
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using _29WxOrderWpf.Ctrls.Statistics.Models;
|
||||
using _29WxOrderWpf.Ctrls.Statistics.ViewModels;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.Statistics
|
||||
{
|
||||
/// <summary>
|
||||
/// 天/周/月周期统计页面(MVVM)。
|
||||
/// 通过 PeriodType 指定统计周期:Day(天统计)/ Week(周统计)/ Month(月统计)。
|
||||
/// </summary>
|
||||
public partial class PeriodRevenueStatisticsView : UserControl
|
||||
{
|
||||
public PeriodRevenueStatisticsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 默认天统计;当 XAML 指定 Week/Month 时通过 PeriodType 回调切换
|
||||
DataContext = new PeriodRevenueStatisticsViewModel(PeriodStatisticType.Day);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PeriodTypeProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(PeriodType),
|
||||
typeof(PeriodStatisticType),
|
||||
typeof(PeriodRevenueStatisticsView),
|
||||
new PropertyMetadata(PeriodStatisticType.Day, OnPeriodTypeChanged));
|
||||
|
||||
/// <summary>统计周期(Day / Week / Month)</summary>
|
||||
public PeriodStatisticType PeriodType
|
||||
{
|
||||
get { return (PeriodStatisticType)GetValue(PeriodTypeProperty); }
|
||||
set { SetValue(PeriodTypeProperty, value); }
|
||||
}
|
||||
|
||||
private static void OnPeriodTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((PeriodRevenueStatisticsView)d).ApplyPeriodType((PeriodStatisticType)e.NewValue);
|
||||
}
|
||||
|
||||
private void ApplyPeriodType(PeriodStatisticType periodType)
|
||||
{
|
||||
DataContext = new PeriodRevenueStatisticsViewModel(periodType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user