Esempio n. 1
0
        /// <summary>
        /// открытие стандартного редактора в зависимости от типа свойства
        /// </summary>
        private void OpenBaseEditor(PropertyInfo property, FastGrid.FastGrid fastGrid, int rowIndex, FastColumn col)
        {
            var coords    = fastGrid.GetCellCoords(col, rowIndex);
            var blankRow  = new FastPropertyGridRow();
            var cellValue =
                fastGrid.rows[rowIndex].cells[fastGrid.Columns.FindIndex(c => c.PropertyName == blankRow.Property(p => p.Value))].CellValue;
            var propType = property.PropertyType;

            if ((propType == typeof(bool) || propType.IsEnum))
            {
                var pop = new PopupListBox(cellValue, rowIndex, col, propType, UpdateObject, fastGrid);
                pop.ShowOptions(coords.X, coords.Y);
                return;
            }
            if ((propType == typeof(string) || Converter.IsConvertable(propType)))
            {
                // редактор подставляется в FastGrid.PopupTextBox
                try
                {
                    var pop = new PopupTextBox(cellValue, col.ResultedWidth, fastGrid.CellHeight, rowIndex, col, property, null);
                    pop.OnValueUpdated += UpdateObject;
                    pop.Show(fastGrid, coords);
                }
                catch (Exception ex)
                {
                    Logger.Error("FastPropertyGrid.OpenBaseEditor", ex);
                }
                return;
            }
        }
Esempio n. 2
0
 // открытие стандартного редактора в зависимости от типа свойства
 private void OpenBaseEditor(PropertyInfo property, FastGrid.FastGrid fastGrid, int rowIndex, FastColumn col)
 {
     var coords = fastGrid.GetCellCoords(col, rowIndex);
     var blankRow = new FastPropertyGridRow();
     var cellValue =
         fastGrid.rows[rowIndex].cells[fastGrid.Columns.FindIndex(c => c.PropertyName == blankRow.Property(p => p.Value))].CellValue;
     var propType = property.PropertyType;
     if ((propType == typeof (bool) || propType.IsEnum))
     {
         var pop = new PopupListBox(cellValue, rowIndex, col, propType, UpdateObject, fastGrid);
         pop.ShowOptions(coords.X, coords.Y);
         return;
     }
     if ((propType == typeof (string) || Converter.IsConvertable(propType)))
     {
         // редактор подставляется в FastGrid.PopupTextBox
         try
         {
             var pop = new PopupTextBox(cellValue, col.ResultedWidth, fastGrid.CellHeight, rowIndex, col, property, null);
             pop.OnValueUpdated += UpdateObject;
             pop.Show(fastGrid, coords);
         }
         catch(Exception ex)
         {
             Logger.Error("FastPropertyGrid.OpenBaseEditor", ex);
         }
         return;
     }
 }