Click here to Skip to main content
15,891,951 members
Articles / Desktop Programming / WPF

WPF: Calendar and Datepicker -Final

Rate me:
Please Sign up or sign in to vote.
4.90/5 (44 votes)
24 Jul 2010CPOL9 min read 268.7K   13.9K   104  
Animated and themed calendar and datepicker controls
#region Directives
using System.Windows;
using System.Windows.Controls;
#endregion

namespace vhCalendar
{
    public sealed class DateButton : Button
    {
        #region Constructor
        static DateButton()
        {
            PropertyMetadata isSelectedMetaData = new PropertyMetadata
            {
                DefaultValue = false,
            };
            IsSelectedProperty = DependencyProperty.Register("IsSelected", typeof(bool), typeof(DateButton), isSelectedMetaData);

            PropertyMetadata isTodaysDateMetaData = new PropertyMetadata
            {
                DefaultValue = false,
            };
            IsTodaysDateProperty = DependencyProperty.Register("IsTodaysDate", typeof(bool), typeof(DateButton), isTodaysDateMetaData);

            PropertyMetadata isBlackOutMetadata = new PropertyMetadata
            {
                DefaultValue = false,
            };
            IsBlackOutProperty = DependencyProperty.Register("IsBlackOut", typeof(bool), typeof(DateButton), isBlackOutMetadata);

            PropertyMetadata isCurrentMonthMetaData = new PropertyMetadata
            {
                DefaultValue = true,
            };
            IsCurrentMonthProperty = DependencyProperty.Register("IsCurrentMonth", typeof(bool), typeof(DateButton), isCurrentMonthMetaData);
        }
        #endregion

        #region DisplayDateStart
        /// <summary>
        /// Gets/Sets the minimum date that is displayed and selected
        /// </summary>
        public static readonly DependencyProperty IsSelectedProperty;

        public bool IsSelected
        {
            get { return (bool)GetValue(IsSelectedProperty); }
            set { SetValue(IsSelectedProperty, value); }
        }
        #endregion

        #region IsBlackOut
        /// <summary>
        /// Gets/Sets button is blacked out
        /// </summary>
        public static readonly DependencyProperty IsBlackOutProperty;

        public bool IsBlackOut
        {
            get { return (bool)GetValue(IsBlackOutProperty); }
            set { SetValue(IsBlackOutProperty, value); }
        }
        #endregion

        #region IsCurrentMonth
        /// <summary>
        /// Gets/Sets button is a member of current month
        /// </summary>
        public static readonly DependencyProperty IsCurrentMonthProperty;

        public bool IsCurrentMonth
        {
            get { return (bool)GetValue(IsCurrentMonthProperty); }
            set { SetValue(IsCurrentMonthProperty, value); }
        }
        #endregion

        #region IsTodaysDate
        /// <summary>
        /// Gets/Sets todays date selection
        /// </summary>
        public static readonly DependencyProperty IsTodaysDateProperty;

        public bool IsTodaysDate
        {
            get { return (bool)GetValue(IsTodaysDateProperty); }
            set { SetValue(IsTodaysDateProperty, value); }
        }
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Network Administrator vtdev.com
Canada Canada
Network and programming specialist. Started in C, and have learned about 14 languages since then. Cisco programmer, and lately writing a lot of C# and WPF code, (learning Java too). If I can dream it up, I can probably put it to code. My software company, (VTDev), is on the verge of releasing a couple of very cool things.. keep you posted.

Comments and Discussions