コード例 #1
0
        private static void dateToText(UDateEntry ctrl, DateTime?dt)
        {
            if (ctrl.internalCall)
            {
                return;
            }

            if (dt == null)
            {
                ctrl.needEventProcess = false;
                ctrl.txtDD.Text       = "";
                ctrl.txtMM.Text       = "";
                ctrl.txtYY2.Text      = "";
                ctrl.needEventProcess = true;

                return;
            }

            int d = ((DateTime)dt).Day;
            int m = ((DateTime)dt).Month;
            int y = ((DateTime)dt).Year;

            ctrl.needEventProcess = false;

            ctrl.txtDD.Text  = d.ToString("D2");
            ctrl.txtMM.Text  = m.ToString("D2");
            ctrl.txtYY2.Text = y.ToString("D4").Substring(2, 2);

            ctrl.needEventProcess = true;
        }
コード例 #2
0
        private static void OnOnlyMonthEvtChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UDateEntry ctrl      = obj as UDateEntry;
            Boolean    onlyMonth = (Boolean)e.NewValue;

            if (onlyMonth)
            {
                ctrl.txtDD.Visibility     = Visibility.Collapsed;
                ctrl.lblSlash1.Visibility = Visibility.Collapsed;
            }
        }
コード例 #3
0
        private static void OnButtonVisibleEvtChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UDateEntry ctrl          = obj as UDateEntry;
            Boolean    buttonVisible = (Boolean)e.NewValue;

            if (!buttonVisible)
            {
                ctrl.cmdClear.Visibility = Visibility.Collapsed;
            }
            else
            {
                ctrl.cmdClear.Visibility = Visibility.Visible;
            }
        }
コード例 #4
0
        private static void OnSelectedDateEvtChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UDateEntry ctrl = obj as UDateEntry;

            dateToText(ctrl, (DateTime?)e.NewValue);
        }