Exemple #1
0
        /// <summary>
        /// Determina si se puede editar la informacion del grid
        /// </summary>
        /// <history>
        /// [vipacheco] 25/Junio/2016 Created
        /// </history>
        private void grdExchange_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            DataGrid           dataGrid           = sender as DataGrid;
            GiftsReceiptDetail giftsReceiptDetail = dataGrid.Items.CurrentItem as GiftsReceiptDetail;

            _currentCell = dtgExchange.CurrentCell;
            ReceiptsGifts.StartEdit(EnumMode.Edit, giftsReceiptDetail, ref _currentCell, ref dtgExchange, ref bandCancel);
        }
Exemple #2
0
 private void grdMain_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.Header.ToString() == nameof(Database.Name))
     {
         Database selectedDB = (Database)grdAppDbs.CurrentItem;
         selectedDB.NameBeforeEdit = selectedDB.Name;
     }
 }
Exemple #3
0
    private void OnBeginningEdit(object sender, DataGridPreparingCellForEditEventArgs e)
    {
        TextBox tbx     = (TextBox)e.EditingElement;
        Binding binding = BindingOperations.GetBinding(tbx, TextBox.TextProperty);

        binding.ValidationRules.Clear();
        binding.ValidationRules.Add(new VR());
    }
        private void DataGrid_P0_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            _preparedCell = true;
            TextBox textBox = e.EditingElement as TextBox;

            Assert.IsNotNull(textBox);
            Assert.IsTrue(!String.IsNullOrEmpty(textBox.Text), "Editing TextBox has no Text");
        }
 void dgScriptData_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     //if (e.Column == colStateCandiate)
     //{
     //    DataGridCell cell = e.Column.GetCellContent(e.Row).Parent as DataGridCell;
     //    cell.IsEnabled = (e.Row.Item as Model).StateCandidates != null;
     //}
 }
Exemple #6
0
 private void grdMain_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.Header.ToString() == nameof(VariableBase.Name))
     {
         VariableBase selectedVarb = (VariableBase)grdVariables.CurrentItem;
         selectedVarb.NameBeforeEdit = selectedVarb.Name;
     }
 }
Exemple #7
0
 private void ApplicationGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.DisplayIndex == 0)//App Name Column
     {
         ApplicationPlatform currentApp = (ApplicationPlatform)xTargetApplicationsGrid.CurrentItem;
         currentApp.NameBeforeEdit = currentApp.AppName;
     }
 }
Exemple #8
0
 void DataGridSudoku_OnPreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.EditingElement is TextBox textBox)
     {
         textBox.PreviewTextInput -= HandlePreviewTextInput;
         textBox.PreviewTextInput += HandlePreviewTextInput;
     }
 }
Exemple #9
0
 private void grdMain_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.Header.ToString() == GeneralParam.Fields.Name)
     {
         GeneralParam selectedVarb = (GeneralParam)grdAppParams.CurrentItem;
         selectedVarb.NameBeforeEdit = selectedVarb.Name;
     }
 }
 private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column is DataGridTemplateColumn column && (string)column?.Tag == "First_ascent" &&
         e.EditingElement is CalendarDatePicker calendar)
     {
         calendar.IsCalendarOpen = true;
     }
 }
        public void BeforeCellChangedHandler(DataGridPreparingCellForEditEventArgs e, Action Unfocus = null)
        {
            int selectedColumn = e.Column.DisplayIndex;

            if (selectedColumn != 0 && (e.Row.Item as DataRowView).Row[selectedColumn] is Journal)
            {
                SelectedAssessment = ((e.Row.Item as DataRowView).Row[selectedColumn] as Journal).Assessment;
            }
        }
Exemple #12
0
        private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var ec = ExtensionServices.GetVisualChild <TextBox>(e.EditingElement as ContentPresenter);

            if (ec != null)
            {
                ec.SelectAll();
            }
        }
        private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (Target == null)
            {
                return;
            }

            Target.IsEnabled = false;
        }
Exemple #14
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var textBox         = e.EditingElement as TextBox;
            var selectedItem    = data.SelectedItem as ListedItem;
            int extensionLength = selectedItem.DotFileExtension?.Length ?? 0;

            previousFileName = selectedItem.FileName;
            textBox.Focus(FocusState.Programmatic); // Without this, cannot edit text box when renaming via right-click
            textBox.Select(0, selectedItem.FileName.Length - extensionLength);
        }
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (ParentShellPageInstance.FilesystemViewModel.WorkingDirectory.StartsWith(AppSettings.RecycleBinPath))
            {
                // Do not rename files and folders inside the recycle bin
                AllView.CancelEdit(); // Cancel the edit operation
                return;
            }

            // Only cancel if this event was triggered by a tap
            // Do not cancel when user presses F2 or context menu
            if (e.EditingEventArgs is TappedRoutedEventArgs)
            {
                if (AppSettings.OpenItemsWithOneclick)
                {
                    AllView.CancelEdit(); // Cancel the edit operation
                    return;
                }

                if (!tapDebounceTimer.IsEnabled)
                {
                    tapDebounceTimer.Debounce(() =>
                    {
                        tapDebounceTimer.Stop();
                        AllView.BeginEdit(); // EditingEventArgs will be null
                    }, TimeSpan.FromMilliseconds(700), false);
                }
                else
                {
                    tapDebounceTimer.Stop();
                    ParentShellPageInstance.InteractionOperations.OpenItem_Click(null, null); // Open selected files
                }

                AllView.CancelEdit(); // Cancel the edit operation
                return;
            }

            int extensionLength = SelectedItem.FileExtension?.Length ?? 0;

            oldItemName = SelectedItem.ItemName;

            renamingTextBox = e.EditingElement as TextBox;
            renamingTextBox.Focus(FocusState.Programmatic); // Without this,the user cannot edit the text box when renaming via right-click

            int selectedTextLength = SelectedItem.ItemName.Length;

            if (AppSettings.ShowFileExtensions)
            {
                selectedTextLength -= extensionLength;
            }
            renamingTextBox.Select(0, selectedTextLength);
            renamingTextBox.TextChanged  += TextBox_TextChanged;
            e.EditingElement.LosingFocus += EditingElement_LosingFocus;
            IsRenamingItem = true;
        }
Exemple #16
0
        // TODO this is a bit of a hack.  remove the context menu from the textBox so that you get
        // my context menu.
        private void Grid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var asTextBox = e.EditingElement as TextBox;
            var window    = this.AncestorOfType <StackWindow>();

            if (asTextBox != null)
            {
                EditingBox            = asTextBox;
                asTextBox.ContextMenu = null;
            }
        }
Exemple #17
0
 private void LocatorsGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.Header.ToString() != nameof(ElementLocator.Active) && e.Column.Header.ToString() != nameof(ElementLocator.Help) && mSelectedLocator.IsAutoLearned)
     {
         if (!disabeledLocatorsMsgShown)
         {
             Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "You can not edit Locator which was auto learned, please duplicate it and create customized Locator.");
             disabeledLocatorsMsgShown = true;
         }
         e.EditingElement.IsEnabled = false;
     }
 }
Exemple #18
0
        private void OnPreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var editingArea = e.EditingElement as TextBox;

            if (editingArea != null)
            {
                if (string.IsNullOrEmpty(editingArea.Text.Trim()))
                {
                    editingArea.Text = "";
                }
            }
        }
        /// <summary>
        /// 編集開始後
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Grid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var textBox = e.EditingElement as TextBox;
            var vm      = e.Row.DataContext as FileItemViewModel;

            if (textBox != null && vm != null)
            {
                //拡張子を除く部分だけ選択する
                var fileNameWOExt = System.IO.Path.GetFileNameWithoutExtension(textBox.Text);
                textBox.SelectionStart  = 0;
                textBox.SelectionLength = fileNameWOExt.Length;
            }
        }
Exemple #20
0
        private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (!(e.Column is DataGridTextColumn && e.EditingElement is TextBox textBox))
            {
                return;
            }
            var style = new Style(typeof(TextBox), textBox.Style);

            style.Setters.Add(new Setter {
                Property = ForegroundProperty, Value = Brushes.Red
            });
            textBox.Style = style;
        }
Exemple #21
0
 /// <summary>
 /// Manda el foco al combobox de edición
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <history>
 /// [emoguel] created 21/07/2016
 /// </history>
 private void dgrGiftInPack_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
 {
     if (e.Column.SortMemberPath == "GiftItem.giN")
     {
         var cp    = (ContentPresenter)e.EditingElement;
         var combo = (ComboBox)cp.ContentTemplate.FindName("cmbGiftPack", cp);
         combo.Focus();
     }
     else
     {
         var txt = e.EditingElement as TextBox;
         txt.Focus();
     }
 }
Exemple #22
0
        private void MainElementsGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (e.Column.Header == "Name" || e.Column.Header == nameof(ElementInfo.Description))
            {
                return;
            }

            ElementInfo ei = (ElementInfo)xMainElementsGrid.CurrentItem;

            if (ei.IsAutoLearned)
            {
                Reporter.ToUser(eUserMsgKeys.StaticWarnMessage, "You can not edit this field of an Element which was auto learned, please duplicate it and create customized Element.");
                e.EditingElement.IsEnabled = false;
            }
        }
Exemple #23
0
        private void DataGridProterties_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var obj = e.EditingElement.DataContext as PropertyItem;

            if (e.Column.Header.ToString() == "B")
            {
                var cb = new ComboBox();
                //e.EditingElement = new ComboBox();
            }
            switch (e.Column.Header.ToString())
            {
            case "Col1":
                //OriginalValue = obj.MyProperty1;
                break;
            }
        }
        private void dgOpeList_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (e.Column.Header.ToString() != "HotKey")
            {
                return;
            }

            if (e.EditingElement is TextBox)
            {
                if (((TextBox)e.EditingElement).Text.StartsWith("combo") == false)
                {
                    ((TextBox)e.EditingElement).Text       = String.Format("combo({{}}, {0})", ComboKey.GetNextHighestPriority());
                    ((TextBox)e.EditingElement).CaretIndex = "combo({".Length;
                }
            }
        }
        private void PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var c = e.Row.DataContext as TableColumn;

            if (e.Column.DisplayIndex == 2)
            {
                if (c != null && TableDataType.IsLengthFixed(c.DataType))
                {
                    var textBox = (e.EditingElement as TextBox);
                    if (textBox != null)
                    {
                        textBox.IsReadOnly = true;
                    }
                }
                else
                {
                    var textBox = (e.EditingElement as TextBox);
                    if (textBox != null)
                    {
                        textBox.IsReadOnly = false;
                    }
                }
            }
            if (e.Column.DisplayIndex != 3)
            {
                return;
            }
            if (c != null && TableDataType.IsNullFixed(c.DataType))
            {
                var checkBox = (e.EditingElement as CheckBox);
                if (checkBox != null)
                {
                    checkBox.IsEnabled = false;
                    checkBox.IsChecked = false;
                }
            }
            else
            {
                var checkBox = (e.EditingElement as CheckBox);
                if (checkBox != null)
                {
                    checkBox.IsEnabled = true;
                    checkBox.IsChecked = false;
                }
            }
        }
        protected override void OnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
        {
            base.OnPreparingCellForEdit(e);

            var editingElementType = e.EditingElement.GetType();

            if (editingElementType == typeof(ComboBox))
            {
                ActiveComboBox(e.EditingElement as ComboBox);
                return;
            }
            if (editingElementType == typeof(DatePicker))
            {
                ActiveDatePicker(e.EditingElement as DatePicker);
                return;
            }
            if (editingElementType == typeof(ForeignKeyPicker))
            {
                ActiveForeignKeyPicker(e.EditingElement as ForeignKeyPicker);
                return;
            }

            //for template column: e.EditingElement is ContentPresenter
            var count = VisualTreeHelper.GetChildrenCount(e.EditingElement);

            for (int i = 0; i < count; i++)
            {
                var element = VisualTreeHelper.GetChild(e.EditingElement, i);
                var type    = element.GetType();
                if (type == typeof(DatePicker))
                {
                    ActiveDatePicker(element as DatePicker);
                    return;
                }
                if (editingElementType == typeof(ComboBox))
                {
                    ActiveComboBox(element as ComboBox);
                    return;
                }
                if (editingElementType == typeof(ForeignKeyPicker))
                {
                    ActiveForeignKeyPicker(e.EditingElement as ForeignKeyPicker);
                    return;
                }
            }
        }
        private void PreparingCellForEditClerkGrid(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            var      row = e.Row.DataContext;
            ComboBox cmb = this.RGReportDataGridClerk.Columns[14].GetCellContent(e.Row) as ComboBox;

            if (cmb != null)
            {
                if (((RGReportRow)row).RemarkText == "RETAKE")
                {
                    cmb.IsEnabled = true;
                }
                else
                {
                    cmb.IsEnabled     = false;
                    cmb.SelectedIndex = -1;
                }
            }
        }
Exemple #28
0
        private void grdMain_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            Database selectedDB = (Database)grdAppDbs.CurrentItem;

            if (e.Column.Header.ToString() == nameof(Database.Name))
            {
                selectedDB.NameBeforeEdit = selectedDB.Name;
            }
            if (selectedDB.DBType == Database.eDBTypes.Cassandra)
            {
                DataGrid    dataGrid = sender as DataGrid;
                DataGridRow row      = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(dataGrid.CurrentItem);
                ToolTipService.SetToolTip(row, new ToolTip {
                    Content = "Expected Format: host:Port/Keyspace/querytimeout=90\nKeyspace and query timeout are optional", Style = FindResource("ToolTipStyle") as Style
                });
                ToolTipService.SetShowDuration(row, 15000);//15sec
            }
        }
        private void CallistoDataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            // If Cell has gone into edit as a result of a keypress (which can only be numeric)
            // then we need to create a key press event for the underlying DecimalTextBox or IntegerTextBox
            // to handle and process the key press.
            if (_lastKeyPress != Key.None)
            {
                var decimalTextBox = e.EditingElement as DecimalTextBox;

                if (decimalTextBox != null)
                {
                    decimalTextBox.RaiseEvent(
                        new System.Windows.Input.KeyEventArgs(Keyboard.PrimaryDevice,
                                                              PresentationSource.FromVisual(decimalTextBox),
                                                              0,
                                                              _lastKeyPress)
                    {
                        RoutedEvent = Keyboard.PreviewKeyDownEvent
                    }
                        );
                    _lastKeyPress = Key.None;
                    return;
                }

                var integerTextBox = e.EditingElement as IntegerTextBox;

                if (integerTextBox != null)
                {
                    integerTextBox.RaiseEvent(
                        new System.Windows.Input.KeyEventArgs(Keyboard.PrimaryDevice,
                                                              PresentationSource.FromVisual(integerTextBox),
                                                              0,
                                                              _lastKeyPress)
                    {
                        RoutedEvent = Keyboard.PreviewKeyDownEvent
                    }
                        );

                    _lastKeyPress = Key.None;
                    return;
                }
            }
        }
Exemple #30
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            // Check if the double tap to rename files setting is off
            if (App.AppSettings.DoubleTapToRenameFiles == false)
            {
                AllView.CancelEdit();                                                 // cancel the edit operation
                App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // open the file instead
                return;
            }

            var textBox         = e.EditingElement as TextBox;
            var selectedItem    = AllView.SelectedItem as ListedItem;
            int extensionLength = selectedItem.FileExtension?.Length ?? 0;

            previousFileName = selectedItem.ItemName;
            textBox.Focus(FocusState.Programmatic); // Without this, cannot edit text box when renaming via right-click
            textBox.Select(0, selectedItem.ItemName.Length - extensionLength);
            isRenamingItem = true;
        }
 /// <summary>
 ///     Called after a cell has changed to editing mode to allow
 ///     subclasses to modify the contents of the cell.
 /// </summary>
 /// <remarks>
 ///     Default implementation raises the PreparingCellForEdit event.
 ///     This method is invoked from DataGridCell (instead of DataGrid) once it has entered edit mode.
 /// </remarks>
 protected internal virtual void OnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
 {
     if (PreparingCellForEdit != null)
     {
         PreparingCellForEdit(this, e);
     }
 }
 private void RaisePreparingCellForEdit(RoutedEventArgs editingEventArgs)
 {
     DataGrid dataGridOwner = DataGridOwner;
     if (dataGridOwner != null)
     {
         FrameworkElement currentEditingElement = EditingElement;
         DataGridPreparingCellForEditEventArgs preparingCellForEditEventArgs = new DataGridPreparingCellForEditEventArgs(Column, RowOwner, editingEventArgs, currentEditingElement);
         dataGridOwner.OnPreparingCellForEdit(preparingCellForEditEventArgs);
     }
 }