Beispiel #1
0
        // Token: 0x06005D66 RID: 23910 RVA: 0x001A48AC File Offset: 0x001A2AAC
        private static void OnWatermarkPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            DatePickerTextBox datePickerTextBox = sender as DatePickerTextBox;

            datePickerTextBox.OnWatermarkChanged();
            datePickerTextBox.UpdateVisualState();
        }
Beispiel #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.x_Tytul = ((System.Windows.Controls.Label)(target));
                return;

            case 2:
                this.x_Tresc = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.x_Data_od = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 4:
                this.x_Data_do = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 5:

            #line 38 "..\..\..\..\View\Kontrolki\Notatka.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #3
0
        /// <summary>
        /// Called when watermark property is changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">
        /// The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/>
        /// instance containing the event data.
        /// </param>
        private static void OnWatermarkPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            DatePickerTextBox datePickerTextBox = sender as DatePickerTextBox;

            Debug.Assert(datePickerTextBox != null, "The source is not an instance of a DatePickerTextBox!");
            datePickerTextBox.OnWatermarkChanged();
            datePickerTextBox.ChangeVisualState();
        }
        /// <summary>
        /// 当应用新模板时生成 UpDownDatePicker 控件的可视化树。
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (btnUp != null)
                btnUp.Click -= btnUp_Click;
            if (btnDown != null)
                btnDown.Click -= btnDown_Click;
            if (txtDate != null)
            {
                txtDate.PreviewMouseLeftButtonDown -= txtDate_PreviewMouseLeftButtonDown;
                txtDate.LostFocus -= txtDate_LostFocus;
            }

            base.OnApplyTemplate();

            btnUp = GetTemplateChild("PART_UpButton") as Button;
            if (btnUp != null)
                btnUp.Click += btnUp_Click;
            btnDown = GetTemplateChild("PART_DownButton") as Button;
            if (btnDown != null)
                btnDown.Click += btnDown_Click;
            popup = GetTemplateChild("PART_Popup") as Popup;
            txtDate = GetTemplateChild("PART_TextBox") as DatePickerTextBox;
            if (txtDate != null)
            {
                if (txtDate.IsReadOnly)
                {
                    var dropDownButton = GetTemplateChild("PART_Button") as Button;
                    if (dropDownButton != null)
                        dropDownButton.Visibility = System.Windows.Visibility.Hidden;
                    txtDate.PreviewMouseLeftButtonDown += txtDate_PreviewMouseLeftButtonDown;
                    txtDate.LostFocus += txtDate_LostFocus;
                }
                else
                {
                    var dropDownButton = GetTemplateChild("PART_Button") as Button;
                    if (dropDownButton != null)
                        dropDownButton.Visibility = System.Windows.Visibility.Visible;
                }
            }
        }
Beispiel #5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 25 "..\..\..\..\View\Kontrolki\Zadanie - Copy.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked);

            #line default
            #line hidden

            #line 26 "..\..\..\..\View\Kontrolki\Zadanie - Copy.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Unchecked);

            #line default
            #line hidden
                return;

            case 2:
                this.x_NazwaZadania = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.x_Data_od = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 4:
                this.x_Data_do = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 5:
                this.x_ID = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
        /// <summary>
        /// Builds the visual tree for the
        /// <see cref="T:System.Windows.Controls.DatePicker" /> control when a
        /// new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (_popUp != null)
            {
                _popUp.Child = null;
            }

            _popUp = GetTemplateChild(ElementPopup) as Popup;

            if (_popUp != null)
            {
                if (this._outsideCanvas == null)
                {
                    _outsideCanvas = new Canvas();
                    _outsidePopupCanvas = new Canvas();
                    _outsidePopupCanvas.Background = new SolidColorBrush(Colors.Transparent);
                    _outsideCanvas.Children.Add(this._outsidePopupCanvas);
                    _outsideCanvas.Children.Add(this._calendar);
                    _outsidePopupCanvas.MouseLeftButtonDown += new MouseButtonEventHandler(OutsidePopupCanvas_MouseLeftButtonDown);
                }

                _popUp.Child = this._outsideCanvas;
                _root = GetTemplateChild(ElementRoot) as FrameworkElement;

                if (this.IsDropDownOpen)
                {
                    OpenDropDown();
                }
            }

            if (_dropDownButton != null)
            {
                _dropDownButton.Click -= new RoutedEventHandler(DropDownButton_Click);
            }

            _dropDownButton = GetTemplateChild(ElementButton) as Button;
            if (_dropDownButton != null)
            {
                _dropDownButton.Click += new RoutedEventHandler(DropDownButton_Click);
                _dropDownButton.IsTabStop = false;

                // If the user does not provide a Content value in template, we
                // provide a helper text that can be used in Accessibility this
                // text is not shown on the UI, just used for Accessibility
                // purposes
                if (_dropDownButton.Content == null)
                {
                    _dropDownButton.Content = System.Windows.Controls.Properties.Resources.DatePicker_DropDownButtonName;
                }
            }

            if (_textBox != null)
            {
                _textBox.KeyDown -= new KeyEventHandler(TextBox_KeyDown);
                _textBox.TextChanged -= new TextChangedEventHandler(TextBox_TextChanged);
                _textBox.GotFocus -= new RoutedEventHandler(TextBox_GotFocus);
            }

            _textBox = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            UpdateDisabledVisual();
            if (this.SelectedDate == null)
            {
                SetWaterMarkText();
            }

            if (_textBox != null)
            {
                _textBox.KeyDown += new KeyEventHandler(TextBox_KeyDown);
                _textBox.TextChanged += new TextChangedEventHandler(TextBox_TextChanged);
                _textBox.GotFocus += new RoutedEventHandler(TextBox_GotFocus);

                if (this.SelectedDate == null)
                {
                    if (!string.IsNullOrEmpty(this._defaultText))
                    {
                        _textBox.Text = this._defaultText;
                        SetSelectedDate();
                    }
                }
                else
                {
                    _textBox.Text = this.DateTimeToString((DateTime) this.SelectedDate);
                }
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 13 "..\..\..\Main\wndMain.xaml"
                ((FinalProject.MainWindow)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.longClickDown);

            #line default
            #line hidden
                return;

            case 2:
                this.closeWindowBtn = ((System.Windows.Controls.Button)(target));

            #line 47 "..\..\..\Main\wndMain.xaml"
                this.closeWindowBtn.Click += new System.Windows.RoutedEventHandler(this.closeWindowBtnClicked);

            #line default
            #line hidden
                return;

            case 3:
                this.searchInvoicesBtn = ((System.Windows.Controls.MenuItem)(target));

            #line 50 "..\..\..\Main\wndMain.xaml"
                this.searchInvoicesBtn.Click += new System.Windows.RoutedEventHandler(this.searchInvoicesBtnClicked);

            #line default
            #line hidden
                return;

            case 4:
                this.editItemsBtn = ((System.Windows.Controls.MenuItem)(target));

            #line 51 "..\..\..\Main\wndMain.xaml"
                this.editItemsBtn.Click += new System.Windows.RoutedEventHandler(this.editItemsBtnClicked);

            #line default
            #line hidden
                return;

            case 5:
                this.currentInvoiceGroupBox = ((System.Windows.Controls.GroupBox)(target));
                return;

            case 6:
                this.currentInvoiceGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.currentInvoiceNumber = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.currentInvoiceDate = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 9:
                this.currentInvoiceItemsComboBox = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 10:
                this.currentInvoiceTotal = ((System.Windows.Controls.Label)(target));
                return;

            case 11:
                this.emptyInvoieGroupBox = ((System.Windows.Controls.GroupBox)(target));
                return;

            case 12:
                this.emptyInvoiceGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 13:

            #line 80 "..\..\..\Main\wndMain.xaml"
                ((System.Windows.Controls.Label)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.searchInvoicesBtnClicked);

            #line default
            #line hidden
                return;

            case 14:

            #line 82 "..\..\..\Main\wndMain.xaml"
                ((System.Windows.Controls.Label)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.createNewInvoiceBtnClicked);

            #line default
            #line hidden
                return;

            case 15:
                this.createInvoiceGroupBox = ((System.Windows.Controls.GroupBox)(target));
                return;

            case 16:
                this.createInvoiceCancelBtn = ((System.Windows.Controls.Button)(target));

            #line 104 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceCancelBtn.Click += new System.Windows.RoutedEventHandler(this.createInvoiceCancelBtnClicked);

            #line default
            #line hidden
                return;

            case 17:
                this.createInvoiceCreateInvoiceBtn = ((System.Windows.Controls.Button)(target));

            #line 105 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceCreateInvoiceBtn.Click += new System.Windows.RoutedEventHandler(this.createInvoice);

            #line default
            #line hidden
                return;

            case 18:
                this.createInvoiceTotal = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.createInvoiceItemsDataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 107 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceItemsDataGrid.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.doubleClickDataGridName);

            #line default
            #line hidden
                return;

            case 20:
                this.createInvoiceInvoiceItemsDataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 114 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceInvoiceItemsDataGrid.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.doubleClickDataGridName);

            #line default
            #line hidden

            #line 114 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceInvoiceItemsDataGrid.CellEditEnding += new System.EventHandler <System.Windows.Controls.DataGridCellEditEndingEventArgs>(this.cellInvoiceCostChanged);

            #line default
            #line hidden
                return;

            case 21:
                this.createInvoiceDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 121 "..\..\..\Main\wndMain.xaml"
                this.createInvoiceDatePicker.CalendarClosed += new System.Windows.RoutedEventHandler(this.calenderClosed);

            #line default
            #line hidden
                return;

            case 22:
                this.editInvoiceGroupBox = ((System.Windows.Controls.GroupBox)(target));
                return;

            case 23:
                this.editInvoiceCancelBtn = ((System.Windows.Controls.Button)(target));

            #line 143 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceCancelBtn.Click += new System.Windows.RoutedEventHandler(this.editInvoiceCancelBtnClicked);

            #line default
            #line hidden
                return;

            case 24:
                this.editInvoiceSaveEditsBtn = ((System.Windows.Controls.Button)(target));

            #line 144 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceSaveEditsBtn.Click += new System.Windows.RoutedEventHandler(this.editInvoiceSaveEditsBtnClicked);

            #line default
            #line hidden
                return;

            case 25:
                this.editInvoiceTotal = ((System.Windows.Controls.Label)(target));
                return;

            case 26:
                this.editInvoiceItemsDataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 146 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceItemsDataGrid.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.doubleClickDataGridName);

            #line default
            #line hidden
                return;

            case 27:
                this.editInvoiceInvoiceItemsDataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 153 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceInvoiceItemsDataGrid.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.doubleClickDataGridName);

            #line default
            #line hidden

            #line 153 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceInvoiceItemsDataGrid.CellEditEnding += new System.EventHandler <System.Windows.Controls.DataGridCellEditEndingEventArgs>(this.cellInvoiceCostChanged);

            #line default
            #line hidden
                return;

            case 28:
                this.editInvoiceDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 160 "..\..\..\Main\wndMain.xaml"
                this.editInvoiceDatePicker.CalendarClosed += new System.Windows.RoutedEventHandler(this.calenderClosed);

            #line default
            #line hidden
                return;

            case 29:
                this.createNewInvoiceBtn = ((System.Windows.Controls.Button)(target));

            #line 165 "..\..\..\Main\wndMain.xaml"
                this.createNewInvoiceBtn.Click += new System.Windows.RoutedEventHandler(this.createNewInvoiceBtnClicked);

            #line default
            #line hidden
                return;

            case 30:
                this.editCurrentInvoiceBtn = ((System.Windows.Controls.Button)(target));

            #line 166 "..\..\..\Main\wndMain.xaml"
                this.editCurrentInvoiceBtn.Click += new System.Windows.RoutedEventHandler(this.editCurrentInvoiceBtnClicked);

            #line default
            #line hidden
                return;

            case 31:
                this.deleteCurrentInvoiceBtn = ((System.Windows.Controls.Button)(target));

            #line 167 "..\..\..\Main\wndMain.xaml"
                this.deleteCurrentInvoiceBtn.Click += new System.Windows.RoutedEventHandler(this.deleteCurrentInvoiceBtnClicked);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        /// <summary>
        /// Builds the visual tree for the DatePicker control when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (_popUp != null)
            {
                _popUp.RemoveHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened -= PopUp_Opened;
                _popUp.Closed -= PopUp_Closed;
                _popUp.Child = null;
            }

            if (_dropDownButton != null)
            {
                _dropDownButton.Click -= DropDownButton_Click;
                _dropDownButton.RemoveHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave));
            }

            if (_textBox != null)
            {
                _textBox.RemoveHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown));
                _textBox.RemoveHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged));
                _textBox.RemoveHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus));
            }

            base.OnApplyTemplate();

            _popUp = GetTemplateChild(ElementPopup) as Popup;

            if (_popUp != null)
            {
                _popUp.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened += PopUp_Opened;
                _popUp.Closed += PopUp_Closed;
                _popUp.Child = this._calendar;

                if (this.IsDropDownOpen)
                {
                    this._popUp.IsOpen = true;
                }
            }

            _dropDownButton = GetTemplateChild(ElementButton) as Button;
            if (_dropDownButton != null)
            {
                _dropDownButton.Click += DropDownButton_Click;
                _dropDownButton.AddHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave), true);

                // If the user does not provide a Content value in template, we provide a helper text that can be used in Accessibility
                // this text is not shown on the UI, just used for Accessibility purposes
                if (_dropDownButton.Content == null)
                {
                    _dropDownButton.Content = SR.Get(SRID.DatePicker_DropDownButtonName);
                }
            }

            _textBox = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            if (this.SelectedDate == null)
            {
                SetWaterMarkText();
            }

            if (_textBox != null)
            {
                _textBox.AddHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown), true);
                _textBox.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged), true);
                _textBox.AddHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus), true);

                if (this.SelectedDate == null)
                {
                    if (!string.IsNullOrEmpty(this._defaultText))
                    {
                        _textBox.Text = this._defaultText;
                        SetSelectedDate();
                    }
                }
                else
                {
                    _textBox.Text = this.DateTimeToString((DateTime)this.SelectedDate);
                }
            }
        }
Beispiel #9
0
        // Token: 0x06005D62 RID: 23906 RVA: 0x001A481C File Offset: 0x001A2A1C
        private T ExtractTemplatePart <T>(string partName) where T : DependencyObject
        {
            DependencyObject templateChild = base.GetTemplateChild(partName);

            return(DatePickerTextBox.ExtractTemplatePart <T>(partName, templateChild));
        }
Beispiel #10
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\Page1.xaml"
                ((EmployeeBrowserApp.Page1)(target)).Unloaded += new System.Windows.RoutedEventHandler(this.Page_Unloaded);

            #line default
            #line hidden
                return;

            case 2:
                this.tbxName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.tbxGender = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.dpkDateOfBirth = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 5:
                this.btnSaveChanges = ((System.Windows.Controls.Button)(target));

            #line 41 "..\..\Page1.xaml"
                this.btnSaveChanges.Click += new System.Windows.RoutedEventHandler(this.btnUpdateData_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.btnEditData = ((System.Windows.Controls.Button)(target));

            #line 42 "..\..\Page1.xaml"
                this.btnEditData.Click += new System.Windows.RoutedEventHandler(this.btnEditData_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.btnCancel = ((System.Windows.Controls.Button)(target));

            #line 43 "..\..\Page1.xaml"
                this.btnCancel.Click += new System.Windows.RoutedEventHandler(this.btnCancel_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.btnStopService = ((System.Windows.Controls.Button)(target));

            #line 47 "..\..\Page1.xaml"
                this.btnStopService.Click += new System.Windows.RoutedEventHandler(this.btnClose_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.btnStartService = ((System.Windows.Controls.Button)(target));

            #line 48 "..\..\Page1.xaml"
                this.btnStartService.Click += new System.Windows.RoutedEventHandler(this.btnStartService_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.tbkEmployeeid = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.tbxEmplyeeid = ((System.Windows.Controls.TextBox)(target));

            #line 57 "..\..\Page1.xaml"
                this.tbxEmplyeeid.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.tbxEmplyeeid_TextChanged);

            #line default
            #line hidden
                return;

            case 12:
                this.lblClickRecords = ((System.Windows.Controls.Label)(target));
                return;

            case 13:
                this.dgdEmployeeTable = ((System.Windows.Controls.DataGrid)(target));

            #line 75 "..\..\Page1.xaml"
                this.dgdEmployeeTable.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.dgdEmployeeTable_SelectionChanged);

            #line default
            #line hidden
                return;

            case 14:
                this.bdrGridRow2 = ((System.Windows.Controls.Border)(target));
                return;

            case 15:
                this.lblTitle = ((System.Windows.Controls.Label)(target));
                return;

            case 16:
                this.tbxNames = ((System.Windows.Controls.TextBox)(target));
                return;

            case 17:
                this.tlxTheResult = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 18:
                this.btnSubmit = ((System.Windows.Controls.Button)(target));

            #line 86 "..\..\Page1.xaml"
                this.btnSubmit.Click += new System.Windows.RoutedEventHandler(this.btnSubmit_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.UcServiceDayView = ((Service_Reader.ServiceDayView)(target));
     return;
     case 2:
     this.LayoutRoot = ((System.Windows.Controls.Expander)(target));
     return;
     case 3:
     
     #line 34 "..\..\ServiceDayView.xaml"
     ((System.Windows.Controls.DatePicker)(target)).MouseEnter += new System.Windows.Input.MouseEventHandler(this.test);
     
     #line default
     #line hidden
     return;
     case 4:
     this.txtArrivalOnsite = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
     return;
     case 5:
     this.txtDepartSite = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
     return;
     case 6:
     this.txtTravelEnd = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
     return;
     case 7:
     this.txtMileage = ((System.Windows.Controls.TextBox)(target));
     return;
     case 8:
     this.txtTotalTravelToSite = ((System.Windows.Controls.TextBox)(target));
     return;
     case 9:
     this.txtTotalTravelFromSite = ((System.Windows.Controls.TextBox)(target));
     return;
     case 10:
     this.txtTotalTravelTime = ((System.Windows.Controls.TextBox)(target));
     return;
     case 11:
     this.txtTotalTimeOnsite = ((System.Windows.Controls.TextBox)(target));
     return;
     case 12:
     this.txtDailyReport = ((System.Windows.Controls.TextBox)(target));
     return;
     case 13:
     this.txtPartsSupplied = ((System.Windows.Controls.TextBox)(target));
     return;
     }
     this._contentLoaded = true;
 }
Beispiel #12
0
        /// <summary>
        /// Builds the visual tree for the DatePicker control when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (_popUp != null)
            {
                _popUp.RemoveHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened -= PopUp_Opened;
                _popUp.Closed -= PopUp_Closed;
                _popUp.Child = null;
            }

            if (_dropDownButton != null)
            {
                _dropDownButton.Click -= DropDownButton_Click;
                _dropDownButton.RemoveHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave));
            }

            if (_textBox != null)
            {
                _textBox.RemoveHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown));
                _textBox.RemoveHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged));
                _textBox.RemoveHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus));
            }

            base.OnApplyTemplate();

            _popUp = GetTemplateChild(ElementPopup) as Popup;

            if (_popUp != null)
            {
                _popUp.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened += PopUp_Opened;
                _popUp.Closed += PopUp_Closed;
                _popUp.Child = this._calendar;

                if (this.IsDropDownOpen)
                {
                    this._popUp.IsOpen = true;
                }
            }

            _dropDownButton = GetTemplateChild(ElementButton) as Button;
            if (_dropDownButton != null)
            {
                _dropDownButton.Click += DropDownButton_Click;
                _dropDownButton.AddHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave), true);

                // If the user does not provide a Content value in template, we provide a helper text that can be used in Accessibility
                // this text is not shown on the UI, just used for Accessibility purposes
                if (_dropDownButton.Content == null)
                {
                    _dropDownButton.Content = SR.Get(SRID.DatePicker_DropDownButtonName);
                }
            }

            _textBox = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            UpdateDisabledVisual();
            if (this.SelectedDate == null)
            {
                SetWaterMarkText();
            }

            if (_textBox != null)
            {
                _textBox.AddHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown), true);
                _textBox.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged), true);
                _textBox.AddHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus), true);

                if (this.SelectedDate == null)
                {
                    if (!string.IsNullOrEmpty(this._defaultText))
                    {
                        _textBox.Text = this._defaultText;
                        SetSelectedDate();
                    }
                }
                else
                {
                    _textBox.Text = this.DateTimeToString((DateTime)this.SelectedDate);
                }
            }

            if (IsButtonDynamicShow)
            {
                _dropDownButton.Visibility = System.Windows.Visibility.Collapsed;
                Grid oGrid = GetTemplateChild("PART_Root") as Grid;
                oGrid.MouseEnter += new MouseEventHandler(_popUp_MouseEnter);
                oGrid.MouseLeave += new MouseEventHandler(_popUp_MouseLeave);
            }
            if (HideTextBoxBackground)
            {
                _textBox.Watermark = string.Empty;
                _textBox.BorderBrush = null;
                _textBox.BorderThickness = new Thickness(0);
                _textBox.Background = null;
                this.BorderThickness = new Thickness(0);
            }
        }
 /// <summary>
 /// 设置日期显示格式
 /// </summary>
 /// <param name="tbx"></param>
 protected void SetTextMode(DatePickerTextBox tbx)
 {
     if (null == tbx)
         return;
     switch (this.DateMode)
     {
         case CalendarMode.Year:
             DateFormat = "yyyy-MM";
             tbx.Watermark = "<yyyy-MM>";
             break;
         case CalendarMode.Decade:
             DateFormat = "yyyy";
             tbx.Watermark = "<yyyy>";
             break;
         default:
             DateFormat = "yyyy-MM-dd";
             break;
     }
     tbx.UpdateLayout();
 }
        /// <summary>
        /// Builds the visual tree for the DatePicker control when a new template is applied. 
        /// </summary>
        public override void OnApplyTemplate() {
            ReleaseCalendar();
            if (_popUp != null) {
                _popUp.RemoveHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened -= PopUp_Opened;
                _popUp.Closed -= PopUp_Closed;
                _popUp.Child = null;
            }

            if (_dropDownButton != null) {
                _dropDownButton.Click -= DropDownButton_Click;
                _dropDownButton.RemoveHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave));
            }

            if (_todayButton != null) {
                _todayButton.Click -= TodayButton_Click;
                BindingOperations.ClearAllBindings(_todayButton);
            }

            if (_clearButton != null) {
                _clearButton.Click -= ClearButton_Click;
                BindingOperations.ClearAllBindings(_clearButton);
            }

            if (_textBox != null) {
                FocusManager.SetIsFocusScope(_textBox, false);
                _textBox.Focusable = true;
                _textBox.RemoveHandler(KeyDownEvent, new KeyEventHandler(TextBox_KeyDown));
                _textBox.RemoveHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged));
                _textBox.RemoveHandler(LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus));
            }

            base.OnApplyTemplate();

            _calendar = GetTemplateChild(PartCalendarName) as Calendar;
            InitializeCalendar();

            _popUp = GetTemplateChild(PartPopupName) as Popup;

            if (_popUp != null) {
                _popUp.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened += PopUp_Opened;
                _popUp.Closed += PopUp_Closed;
                // While we have a calendar part in control's template ,this line is no longer necessary
                // _popUp.Child = _calendar;
                if (IsDropDownOpen)
                    _popUp.IsOpen = true;
            }

            _dropDownButton = GetTemplateChild(PartDropDownButtonName) as Button;
            if (_dropDownButton != null) {
                _dropDownButton.Click += DropDownButton_Click;
                _dropDownButton.AddHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave), true);
                // If the user does not provide a Content value in template, we 
                // provide a helper text that can be used in Accessibility. This
                // text is not shown on the UI, just used for Accessibility purposes
                if (_dropDownButton.Content == null)
                    _dropDownButton.Content = "Select";
            }

            _todayButton = GetTemplateChild(PartTodayButtonName) as ButtonBase;
            if (_todayButton != null) {
                _todayButton.Click += TodayButton_Click;
                _todayButton.SetBinding(StyleProperty, GetSelfBinding(TodayButtonStyleProperty));
                SetTodayButtonContent();
            }

            _clearButton = GetTemplateChild(PartClearButtonName) as ButtonBase;
            if (_clearButton != null) {
                _clearButton.Click += ClearButton_Click;
                _clearButton.SetBinding(StyleProperty, GetSelfBinding(ClearButtonStyleProperty));
                _clearButton.SetBinding(ContentControl.ContentProperty, GetSelfBinding(ClearButtonContentProperty));
            }

            _textBox = GetTemplateChild(PartTextBoxName) as DatePickerTextBox;

            if (SelectedDate == null) {
                SetWaterMarkText();
            }

            if (_textBox != null) {
                _textBox.AddHandler(KeyDownEvent, new KeyEventHandler(TextBox_KeyDown), true);
                _textBox.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged), true);
                _textBox.AddHandler(LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus), true);

                if (SelectedDate == null) {
                    if (!string.IsNullOrEmpty(_defaultText)) {
                        _textBox.Text = _defaultText;
                        SetSelectedDate();
                    }
                } else
                    _textBox.Text = DateTimeToString((DateTime)SelectedDate);
            }
            UpdateVisualState(true);
        }
Beispiel #15
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     InputField = (DatePickerTextBox)GetTemplateChild("TextBox");
     Label = (StackPanel)GetTemplateChild("Label");
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UcServiceDayView = ((Service_Reader.ServiceDayView)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Expander)(target));
                return;

            case 3:

            #line 34 "..\..\ServiceDayView.xaml"
                ((System.Windows.Controls.DatePicker)(target)).MouseEnter += new System.Windows.Input.MouseEventHandler(this.test);

            #line default
            #line hidden
                return;

            case 4:
                this.txtArrivalOnsite = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 5:
                this.txtDepartSite = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 6:
                this.txtTravelEnd = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 7:
                this.txtMileage = ((System.Windows.Controls.TextBox)(target));
                return;

            case 8:
                this.txtTotalTravelToSite = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.txtTotalTravelFromSite = ((System.Windows.Controls.TextBox)(target));
                return;

            case 10:
                this.txtTotalTravelTime = ((System.Windows.Controls.TextBox)(target));
                return;

            case 11:
                this.txtTotalTimeOnsite = ((System.Windows.Controls.TextBox)(target));
                return;

            case 12:
                this.txtDailyReport = ((System.Windows.Controls.TextBox)(target));
                return;

            case 13:
                this.txtPartsSupplied = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.CurrentTextBox = GetTemplateChild("TextBox") as DatePickerTextBox;
            this.CurrentPopup = GetTemplateChild("Popup") as Popup;
            this.CurrentButon = GetTemplateChild("Button") as Button;

            #region 注册及绑定事件
            if (null != this.CurrentTextBox)
            {
                //this.CurrentTextBox.BorderThickness = new Thickness(1);
                //this.CurrentButon.Margin = new Thickness(-25, 0, 0, 0);
                this.SetTextMode(this.CurrentTextBox);
                this.CurrentTextBox.IsReadOnly = this.IsReadOnly;
                this.CurrentTextBox.TextChanged += ((sender, e) =>
                {
                    if (this.IsReadOnly)
                        this.CurrentTextBox.Text = this.SelectedDate.HasValue ? this.SelectedDate.Value.ToString(this.DateFormat) : "";
                    else
                    {
                        if (this.CurrentTextBox.Text.Trim().Length >= this.DateFormat.Length)
                        {
                            DateTime timeTemp;
                            if (DateTime.TryParse(this.CurrentTextBox.Text.Trim(), out timeTemp))
                                this.CurrentTextBox.Text = timeTemp.ToString(this.DateFormat);
                        }
                        this.InputText = this.CurrentTextBox.Text;
                    }
                    SetTextMode(this.CurrentTextBox);
                });

            }

            this.CalendarClosed += new RoutedEventHandler(DatePickerEx_CalendarClosed);

            if (this.DateMode == CalendarMode.Month)
                return;

            if (null != this.CurrentPopup)
                //利用扩展方法找到Calendar控件
                this.CurrentCalendar = this.CurrentPopup.Child.Descendents().OfType<Calendar>().FirstOrDefault();

            if (null != this.CurrentButon)
                this.CurrentButon.Click += ((sender, e) =>
                {
                    this.CurrentPopup.IsOpen = true;
                });

            if (null != this.CurrentCalendar)
            {

                this.CurrentCalendar.IsTodayHighlighted = true;
                this.CurrentCalendar.DisplayModeChanged += new
                        EventHandler<CalendarModeChangedEventArgs>(CurrentCalendar_DisplayModeChanged);
                this.CurrentCalendar.DisplayMode = this.DateMode;
                this.CurrentCalendar.LostMouseCapture += ((sender, e) =>
                {
                    this.SelectedDate = this.DisplayDate;
                });

            }
            #endregion
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            Popup popup = base.GetTemplateChild("Popup") as Popup;
            m_Calendar = null;
            
            if (popup != null && popup.Child != null)
            { 
                Canvas canvas = popup.Child as Canvas;
                if (canvas != null)
                {
                    foreach (UIElement item in canvas.Children)
                    {
                        m_Calendar = item as Calendar;
                        if (m_Calendar != null)
                            break;
                    }
                }
            }

            m_TextBox = base.GetTemplateChild("TextBox") as DatePickerTextBox;
            //m_TextBox.FontSize = 11;
            //m_TextBox.Padding = new Thickness(2, 0, 2, 0);
            m_TextBox.VerticalAlignment = VerticalAlignment.Center;
            m_TextBox.Text = " ";

            if (m_TextBox != null)
                m_TextBox.IsReadOnly = true;

            var readOnlyVisualElement = base.GetTemplateChild("ReadOnlyVisualElement") as Border;
            if (readOnlyVisualElement != null)
            {
                readOnlyVisualElement.Background = new SolidColorBrush(Colors.Transparent);
            }

            if (m_Calendar != null)
            {
                m_Calendar.DisplayDateChanged += new EventHandler<CalendarDateChangedEventArgs>(calendar_DisplayDateChanged);
            }
        }
Beispiel #19
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.title = ((System.Windows.Controls.DockPanel)(target));
                return;

            case 2:
                this.LoadHome = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.ProfileImage = ((System.Windows.Controls.Image)(target));
                return;

            case 4:
                this.unitTabs = ((MahApps.Metro.Controls.MetroAnimatedTabControl)(target));
                return;

            case 5:
                this.listTab = ((MahApps.Metro.Controls.MetroTabItem)(target));
                return;

            case 6:
                this.LeftSide = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 7:
                this.buttons2 = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 8:
                this.RefreshUnitTable = ((System.Windows.Controls.Button)(target));
                return;

            case 9:
                this.DeleteUnit = ((System.Windows.Controls.Button)(target));
                return;

            case 10:
                this.Units = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 11:
                this.RightSide = ((System.Windows.Controls.Border)(target));
                return;

            case 12:
                this.UnitName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 13:
                this.UnitTypeNames = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 14:
                this.UnitStatusNames = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 15:
                this.UnitAddress = ((System.Windows.Controls.TextBox)(target));
                return;

            case 16:
                this.UnitStartDate = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 17:
                this.UnitCompletionDate = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
                return;

            case 18:
                this.SaveUnit = ((System.Windows.Controls.Button)(target));
                return;

            case 19:
                this.ClearUnitFields = ((System.Windows.Controls.Button)(target));
                return;

            case 20:
                this.progressTab = ((MahApps.Metro.Controls.MetroTabItem)(target));
                return;

            case 21:
                this.LeftSideUP = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 22:
                this.buttons2UP = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 23:
                this.AddNewProgress = ((System.Windows.Controls.Button)(target));
                return;

            case 24:
                this.RefreshProgressTable = ((System.Windows.Controls.Button)(target));
                return;

            case 25:
                this.DeleteProgress = ((System.Windows.Controls.Button)(target));
                return;

            case 26:
                this.ProgressOfUnits = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 27:
                this.ConvertedImage = ((System.Windows.Controls.Image)(target));
                return;

            case 28:
                this.RightSideUP = ((System.Windows.Controls.Border)(target));
                return;

            case 29:
                this.CurrentUnit = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 30:
                this.CurrentUnitType = ((System.Windows.Controls.TextBox)(target));
                return;

            case 31:
                this.CurrentAddress = ((System.Windows.Controls.TextBox)(target));
                return;

            case 32:
                this.Notes = ((System.Windows.Controls.TextBox)(target));
                return;

            case 33:
                this.FileLocation = ((System.Windows.Controls.TextBox)(target));
                return;

            case 34:
                this.SelectImage = ((System.Windows.Controls.Button)(target));
                return;

            case 35:
                this.SaveProgress = ((System.Windows.Controls.Button)(target));
                return;

            case 36:
                this.ClearProgressFields = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.DateOfBirthTextBox = ((System.Windows.Controls.Primitives.DatePickerTextBox)(target));
     return;
     case 2:
     this.SaveButton = ((System.Windows.Controls.Button)(target));
     
     #line 10 "..\..\MainWindow.xaml"
     this.SaveButton.Click += new System.Windows.RoutedEventHandler(this.SaveButton_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
Beispiel #21
0
        /// <summary>
        ///     When overridden in a derived class, is invoked whenever application code or internal processes call
        ///     <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            UnSubscribeEvents();

            _popup = GetTemplateChild(ElementPopup) as Popup;
            _button = GetTemplateChild(ElementButton) as Button;
            _hourInput = GetTemplateChild(ElementHourPicker) as Selector;
            _minuteInput = GetTemplateChild(ElementMinutePicker) as Selector;
            _secondInput = GetTemplateChild(ElementSecondPicker) as Selector;
            _hourHand = GetTemplateChild(ElementHourHand) as FrameworkElement;
            _ampmSwitcher = GetTemplateChild(ElementAmPmSwitcher) as Selector;
            _minuteHand = GetTemplateChild(ElementMinuteHand) as FrameworkElement;
            _secondHand = GetTemplateChild(ElementSecondHand) as FrameworkElement;
            _textBox = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            SetHandVisibility(HandVisibility);
            SetPickerVisibility(PickerVisibility);

            SetHourPartValues(SelectedTime.GetValueOrDefault());
            WriteValueToTextBox();

            SetDefaultTimeOfDayValues();
            SubscribeEvents();
            ApplyCulture();
            ApplyBindings();

        }