Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        private void ResetToolsButtonAfterEditing()
        {
            PersonInfoTextboxesEdit(false);
            DeleteButton.SetValue(RelativePanel.LeftOfProperty, EditButton.Name);
            ToolsPanel.Children.RemoveAt(1);

            AddButton.Visibility = Visibility.Visible;
            AddButton.IsEnabled  = true;

            EditButton.Content = "\xE104";
            EditButton.Tag     = EditButtonState.ReadyForEdit;
        }
Beispiel #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            //((Button)sender).Tag = EditButtonState.ReadyForEdit
            var button = sender as Button;

            switch (button.Tag)
            {
            // 进入编辑模式
            case EditButtonState.ReadyForEdit:
                target_StudentNumber = vm.PersonOnDisplay.StudentNumber; // 保存原学号副本

                button.Content = "\xE081";                               // √
                button.Tag     = EditButtonState.ReadyForSave;
                PersonInfoTextboxesEdit(true);

                // 显示退出编辑模式按钮
                Button cancelButton = new Button()
                {
                    Name    = "CancelButton",
                    Content = "\xE10A",
                    Style   = (Style)this.Resources["SymbolButtonStyle"]
                };
                ToolsPanel.Children.Insert(1, cancelButton);
                cancelButton.Click += CancelButton_Click;
                cancelButton.SetValue(RelativePanel.AlignVerticalCenterWithPanelProperty, true);
                cancelButton.SetValue(RelativePanel.LeftOfProperty, EditButton.Name);
                DeleteButton.SetValue(RelativePanel.LeftOfProperty, cancelButton.Name);

                AddButton.Visibility = Visibility.Collapsed;
                AddButton.IsEnabled  = false;

                break;

            // 保存、提交并退出编辑模式
            case EditButtonState.ReadyForSave:
                ResetToolsButtonAfterEditing();
                SubmitEditedInfo();
                break;
            }
        }