原文: View Code View Code
封装了一个选择年月的控件,XAML代码:
后台代码:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.ComponentModel;namespace SunCreate.CombatPlatform.Client{ ////// /// public partial class DateMonthPicker : UserControl, INotifyPropertyChanged { private DateTime _selectedMonth; public static DependencyProperty selectedTimeProperty; static DateMonthPicker() { selectedTimeProperty = DependencyProperty.Register("SelectedMonth", typeof(DateTime), typeof(DateMonthPicker), new PropertyMetadata(DateTime.Now, new PropertyChangedCallback(SelectedMonthChanged))); } public DateMonthPicker() { InitializeComponent(); int currentYear = DateTime.Now.Year; int currentMonth = DateTime.Now.Month; List
效果图:
posted on 2019-04-02 11:57 阅读( ...) 评论( ...)