Esempio n. 1
0
 /// <summary>
 /// 得到InsertionRow
 /// </summary>
 /// <returns></returns>
 public static InsertionRow GetInsertionRow(this IGrid grid)
 {
     foreach (Row row in grid.FixedFooterRows)
     {
         InsertionRow r = row as InsertionRow;
         if (row != null)
         {
             return(r);
         }
     }
     foreach (Row row in grid.FixedHeaderRows)
     {
         InsertionRow r = row as InsertionRow;
         if (row != null)
         {
             return(r);
         }
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        /// Change item's name.
        /// </summary>
        /// <param name="e">DataGridItemEventArgs.</param>
        /// <param name="insertionRow">InsertionRow in which new item is placed.</param>
        protected override void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e,
                                            InsertionRow insertionRow)
        {
            // Check that item's name is null.
            if (!string.IsNullOrEmpty((e.Item as VehicleSpecialty).Name))
            {
                return;
            }

            // Get new item's name.
            (e.Item as VehicleSpecialty).Name = DataObjectNamesConstructor.GetNameForNewDataObject(
                App.Current.Project.VehicleSpecialties, e.Item as VehicleSpecialty, true);

            // Find TextBox inside the cell and select new name.
            Cell    currentCell = insertionRow.Cells[XceedGrid.CurrentContext.CurrentColumn];
            TextBox textBox     = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell);

            if (textBox != null)
            {
                textBox.SelectAll();
            }
        }
 private void InsertionRow_Initialized(object sender, EventArgs e)
 {
     _insertionRow = sender as InsertionRow;
 }
 /// <summary>
 /// Occurs when insertion row initialized.
 /// </summary>
 /// <param name="sender">Insertion row.</param>
 /// <param name="e">Ignored.</param>
 private void InsertionRow_Initialized(object sender, EventArgs e)
 {
     _InsertionRow = sender as InsertionRow;
     if (_InsertionRow.Cells["HardZones"] != null)
         _InsertionRow.Cells["HardZones"].Visibility = Visibility.Hidden;
 }
 private void InsertionRow_Loaded(object sender, RoutedEventArgs e)
 {
     _insertionRow = (InsertionRow)sender;
 }
 /// <summary>
 /// Change item's name.
 /// </summary>
 /// <param name="e">DataGridItemEventArgs.</param>
 protected abstract void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e,
     InsertionRow insertionRow);
 /// <summary>
 /// Initializes _routesInsertionRow.
 /// </summary>
 /// <param name="sender">Routes insertion row sender.</param>
 /// <param name="e">Event args.</param>
 private void _RoutesInsertionRowInitialized(object sender, EventArgs e)
 {
     _routesInsertionRow = (InsertionRow)sender;
 }
Esempio n. 8
0
 /// <summary>
 /// Change item's name.
 /// </summary>
 /// <param name="e">DataGridItemEventArgs.</param>
 protected abstract void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e,
                                     InsertionRow insertionRow);
 private void InsertionRow_Initialized(object sender, EventArgs e)
 {
     _InsertionRow = sender as InsertionRow;
     if (0 < _InsertionRow.Cells.Count)
         _InsertionRow.Cells[IS_CURRENT_COLUMN_CAPTION].Template = null;
 }
        /// <summary>
        /// Initializes insertion row.
        /// </summary>
        /// <param name="sender">Data grid control.</param>
        /// <param name="e">Event args.</param>
        private void _InitializingInsertionRow(object sender, InitializingInsertionRowEventArgs e)
        {
            // If insertion row was initialized before - remove handlers to avoid redundant calls.
            if (_insertionRow != null)
            {
                _insertionRow.EditBegun -= _InsertionRowEditBegun;
                _insertionRow.EditCanceled -= _InsertionRowEditCanceled;
            }

            _insertionRow = e.InsertionRow;

            // Remember default background of InsertionRow (VisualBrush with text "Click here...").
            if (_insertionRowDefaultBackground == null)
                _insertionRowDefaultBackground = _insertionRow.Background;

            // Subscribe to events to set valid background for InsertoinRow.
            _insertionRow.EditBegun += new RoutedEventHandler(_InsertionRowEditBegun);
            _insertionRow.EditCanceled += new RoutedEventHandler(_InsertionRowEditCanceled);
        }
 /// <summary>
 /// Initializes _ordersInsertionRow.
 /// </summary>
 /// <param name="sender">Orders insertion row sender.</param>
 /// <param name="e">Event args.</param>
 private void _OrdersInsertionRowInitialized(object sender, EventArgs e)
 {
     _ordersInsertionRow = (InsertionRow)sender;
 }
        /// <summary>
        /// Change item's name.
        /// </summary>
        /// <param name="e">DataGridItemEventArgs.</param>
        /// <param name="insertionRow">InsertionRow in which new item is placed.</param>
        protected override void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e,
            InsertionRow insertionRow)
        {
            // Check that item's name is null.
            if (!string.IsNullOrEmpty((e.Item as DriverSpecialty).Name))
                return;

            // Get new item's name.
            (e.Item as DriverSpecialty).Name = DataObjectNamesConstructor.GetNameForNewDataObject(
                App.Current.Project.DriverSpecialties, e.Item as DriverSpecialty, true);

            // Find TextBox inside the cell and select new name.
            Cell currentCell = insertionRow.Cells[XceedGrid.CurrentContext.CurrentColumn];
            TextBox textBox = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell);
            if (textBox != null)
                textBox.SelectAll();
        }