コード例 #1
0
        protected override void setColumnEditSettings(GridColumn column, GrilleColumn grilleColumn, bool readOnly = false)
        {
            bool isIncremental = grilleColumn.attribute.incremental;
            bool isKey         = ((LinkedAttributeGrid)Grille).attribute.oid == grilleColumn.attribute.oid;

            if (!isIncremental)
            {
                try
                {
                    grilleColumn.values = Service.ModelService.getLeafAttributeValues(grilleColumn.valueOid.Value);
                }
                catch (Exception) { }
                ComboBoxEditSettings combo = new ComboBoxEditSettings();
                combo.ItemsSource         = grilleColumn.Items;
                combo.IsTextEditable      = true;
                combo.ShowText            = true;
                combo.ValidateOnTextInput = true;

                combo.AllowNullInput       = !isKey;
                combo.AutoComplete         = true;
                combo.IncrementalFiltering = true;
                combo.ImmediatePopup       = true;

                column.AllowIncrementalSearch = true;
                column.EditSettings           = combo;
            }
        }
コード例 #2
0
        public AutoFilterRow()
        {
            InitializeComponent();
            grid.ItemsSource = OutlookDataGenerator.CreateOutlookDataTable(1000);
            ComboBoxEditSettings settings = new ComboBoxEditSettings()
            {
                IsTextEditable = false
            };

            ComboBoxEdit.SetupComboBoxSettingsEnumItemSource <Priority>(settings);
            colPriority.EditSettings = settings;
        }
コード例 #3
0
        public CellEditors()
        {
            InitializeComponent();
            ComboBoxEditSettings settings = new ComboBoxEditSettings()
            {
                IsTextEditable = false
            };

            ComboBoxEdit.SetupComboBoxSettingsEnumItemSource <Priority>(settings);
            colPriority.EditSettings = settings;
            grid.ItemsSource         = OutlookDataGenerator.CreateOutlookDataTable(1000);
            booleanColumnEditorListBox.EditValueChanged  += new EditValueChangedEventHandler(booleanColumnEditorListBox_EditValueChanged);
            editorButtonShowModeListBox.EditValueChanged += new EditValueChangedEventHandler(editorButtonShowModeListBox_EditValueChanged);
            viewsListBox.EditValueChanged += new EditValueChangedEventHandler(viewsListBox_SelectionChanged);
            alternativeDisplayTemplateCheckBox.IsChecked = true;
            alternativeEditTemplateCheckBox.IsChecked    = true;
            editorShowModeCombobox.EditValueChanged     += new EditValueChangedEventHandler(editorShowModeCombobox_EditValueChanged);
        }
コード例 #4
0
        public Window1()
        {
            InitializeComponent();
            cars   = new BindingList <Car>();
            colors = new BindingList <CustomColor>();

            cars.Add(new Car()
            {
                AvailableColor = 2, Make = "Make1"
            });
            cars.Add(new Car()
            {
                AvailableColor = 1, Make = "Make2"
            });
            cars.Add(new Car()
            {
                AvailableColor = 3, Make = "Make1"
            });

            gridControl1.ItemsSource = cars;

            colors.Add(new CustomColor()
            {
                ID = 1, Name = "Red"
            });
            colors.Add(new CustomColor()
            {
                ID = 2, Name = "Blue"
            });
            colors.Add(new CustomColor()
            {
                ID = 3, Name = "Pink"
            });


            ComboBoxEditSettings combo = new ComboBoxEditSettings();

            combo.ItemsSource    = colors;
            combo.DisplayMember  = "Name";
            combo.ValueMember    = "ID";
            combo.IsTextEditable = false;
            gridControl1.Columns["AvailableColor"].EditSettings = combo;
        }
コード例 #5
0
        /////////////////////////////////Заполнение справочника номенклатуры-----------------------------------------

        public void LoadGridNom(GridControl name_grid, GridControl name_sender)
        {
            DataTable dt = new DataTable();

            presh.flag = false;
            if (presh.preh.fb.State == ConnectionState.Closed)
            {
                presh.preh.fb.Open();
            }
            FbCommand    command = new FbCommand("select * from PROC_SELECT_NOM WHERE ID_KIND_NOM =" + name_sender.GetFocusedRowCellValue("ID"), presh.preh.fb);
            FbDataReader reader  = command.ExecuteReader();

            dt.Load(reader);
            dt.Columns[0].ColumnName = "ID";
            dt.Columns[1].ColumnName = "Полное наименование";
            dt.Columns[2].ColumnName = "Сокращенное наименование";
            dt.Columns[3].ColumnName = "Единица измерения";
            dt.Columns[4].ColumnName = "Артикул";


            name_grid.ItemsSource        = dt;
            name_grid.Columns[0].Visible = false;
            name_grid.Columns[5].Visible = false;

            FbCommand    sqlforcomb = new FbCommand("select * from GET_MEASURE_EDIT", presh.preh.fb);
            FbDataReader readercomb = sqlforcomb.ExecuteReader();
            DataTable    dtcomb     = new DataTable();

            dtcomb.Load(readercomb);
            ComboBoxEditSettings cb_set_k_nom = new ComboBoxEditSettings();

            cb_set_k_nom.ItemsSource          = dtcomb;
            cb_set_k_nom.DisplayMember        = "SN";
            cb_set_k_nom.ValueMember          = "SN";
            name_grid.Columns[3].EditSettings = cb_set_k_nom;
            presh.flag = true;
        }
コード例 #6
0
ファイル: GridBrowser.cs プロジェクト: schifflee/bcephal2
        protected virtual void setColumnEditSettings(GridColumn column, GrilleColumn grilleColumn, bool readOnly = false)
        {
            if (grilleColumn.type.Equals(ParameterType.MEASURE.ToString()))
            {
                TextEditSettings settings = new TextEditSettings();
                settings.DisplayFormat       = "N2";
                settings.ValidateOnTextInput = true;
                settings.AllowNullInput      = true;
                column.EditSettings          = settings;
            }

            if (!this.Grille.report && grilleColumn.type.Equals(ParameterType.SCOPE.ToString()))
            {
                try
                {
                    grilleColumn.values = Service.ModelService.getLeafAttributeValues(grilleColumn.valueOid.Value);
                }
                catch (Exception) { }
                ComboBoxEditSettings combo = new ComboBoxEditSettings();
                combo.ItemsSource         = grilleColumn.Items;
                combo.IsTextEditable      = true;
                combo.ShowText            = true;
                combo.ValidateOnTextInput = true;
                combo.AllowNullInput      = true;
                column.EditSettings       = combo;
            }
            else if (!this.Grille.report && grilleColumn.type.Equals(ParameterType.PERIOD.ToString()))
            {
                DateEditSettings dateSetting = new DateEditSettings();
                dateSetting.IsTextEditable      = true;
                dateSetting.ShowText            = true;
                dateSetting.ValidateOnTextInput = true;
                dateSetting.AllowNullInput      = true;
                column.EditSettings             = dateSetting;
            }
        }
コード例 #7
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            var column = (GridColumnVm)value;

            object editor = null;

            switch (column.GridColumnType)
            {
            case GridColumnType.String:
                var editorTextEdit = new TextEditSettings();
                editorTextEdit.TextWrapping = System.Windows.TextWrapping.WrapWithOverflow;
                ReflectionUtils.SetProperty(editorTextEdit, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Center);
                editor = editorTextEdit;
                break;

            case GridColumnType.Int:
            case GridColumnType.Decimal:
                var columnSetting = column.ColumnSetting as SpinColumnSetting;
                var editor1       = new SpinEditSettings();
                ReflectionUtils.SetProperty(editor1, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Right);
                if (columnSetting != null)
                {
                    editor1.Mask = columnSetting.Mask;
                }
                NumericMaskOptions.SetAlwaysShowDecimalSeparator(editor1, false);
                editor1.MaskUseAsDisplayFormat = true;
                editor = editor1;
                break;

            case GridColumnType.Date:
                break;

            case GridColumnType.DateTime:
                var dateColumnSetting = column.ColumnSetting as DateColumnSetting;
                var dateEditor        = new DateEditSettings();
                if (dateColumnSetting == null)
                {
                    dateColumnSetting = new DateColumnSetting();
                    if (column.GridColumnType == GridColumnType.Date)
                    {
                        dateColumnSetting.Mask = "yyyy-MM-dd";
                    }
                    else
                    {
                        dateColumnSetting.Mask = "yyyy-MM-dd HH:mm:ss";
                    }
                }
                dateEditor.Mask = dateColumnSetting.Mask;
                dateEditor.MaskUseAsDisplayFormat = true;
                ReflectionUtils.SetProperty(dateEditor, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Left);
                editor = dateEditor;
                break;

            case GridColumnType.Enum:
            case GridColumnType.Combo:
                var comboColumnSetting = column.ColumnSetting as ComboBoxColumnSetting;
                if (comboColumnSetting == null)
                {
                    editor = new TextEditSettings();
                    break;
                }
                var enumEditor           = new ComboBoxEditSettings();
                var comboBoxEditSettings = new ComboBoxEditSettings();
                comboBoxEditSettings.ItemsSource = comboColumnSetting.ItemsSource;
                comboBoxEditSettings.HorizontalContentAlignment = EditSettingsHorizontalAlignment.Center;
                if (!string.IsNullOrWhiteSpace(comboBoxEditSettings.ValueMember))
                {
                    comboBoxEditSettings.ValueMember = comboColumnSetting.ValueMember;
                }
                if (!string.IsNullOrWhiteSpace(comboBoxEditSettings.DisplayMember))
                {
                    comboBoxEditSettings.DisplayMember = comboColumnSetting.DisplayMember;
                }
                editor = comboBoxEditSettings;
                break;

            case GridColumnType.Bool:
                editor = new CheckEditSettings {
                    IsThreeState = false, NullValue = false
                };
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(editor);
        }
コード例 #8
0
        /// <summary>
        /// 所有对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="fieldCustoms"></param>
        public override void  SetPagerPage <T1>(IList <T1> list, IList <FieldCustom> fieldCustoms, bool isAutoObjectID = true, bool isHiddenSelected = false, Visibility ExportBtuGridIsShow = Visibility.Hidden)
        {
            ExportBtuGrid.Visibility = ExportBtuGridIsShow;
            //添加要使用的index
            int count = fieldCustoms.Count;

            int[] indexs = new int[count];
            if (!isHiddenSelected)
            {
                select.Visible = isHiddenSelected;
                //this.tabGrid.Columns.Remove(select);
            }


            //添加标题
            for (int a = 0; a < count; a++)
            {
                FieldCustom fieldCustom = fieldCustoms[a];
                GridColumn  column      = new GridColumn
                {
                    Width   = fieldCustom.Width,
                    Header  = fieldCustom.AliasName,
                    Binding = new Binding(fieldCustom.Name)
                    {
                        Mode = fieldCustom.Mode
                    },
                };


                if (fieldCustom.Editable)
                {
                    column.AllowEditing = DevExpress.Utils.DefaultBoolean.True;
                }
                if (fieldCustom is ComBoxFieldCustom)
                {
                    ComBoxFieldCustom    comBoxFieldCustom    = (ComBoxFieldCustom)fieldCustom;
                    ComboBoxEditSettings comboBoxEditSettings = new ComboBoxEditSettings {
                        ItemsSource = comBoxFieldCustom.Items, DisplayMember = comBoxFieldCustom.DisplayMember, ValueMember = comBoxFieldCustom.ValueMember
                    };
                    //comboBoxEditSettings.IsTextEditable = true;
                    comboBoxEditSettings.ValidateOnTextInput = false;
                    comboBoxEditSettings.AcceptsReturn       = false;
                    comboBoxEditSettings.PreviewTextInput   += ComboxTextChange;
                    column.EditSettings = comboBoxEditSettings;
                }
                else if (fieldCustom is CheckBoxFieldCustom)
                {
                    //-------------添加选择列
                    //--dgrid为DataGrid实例对象,Row_Checked是响应事件。
                    //GridColumn dgtc = new GridColumn();
                    //dgtc.Header = "选择123";
                    DataTemplate dt = new DataTemplate();
                    //定义子元素
                    FrameworkElementFactory fef = new FrameworkElementFactory(typeof(CheckBox));
                    var binding = new Binding(fieldCustom.Name);
                    fef.SetValue(CheckBox.IsCheckedProperty, binding);
                    //fef.SetValue(CheckBox.ForegroundProperty, Brushes.Red);
                    fef.SetValue(CheckBox.ContentProperty, fieldCustom.AliasName);
                    fef.SetValue(CheckBox.NameProperty, fieldCustom.Name);
                    //关键部分,为每一项添加事件理解AddHandler的用法
                    fef.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(Row_Checked));
                    fef.AddHandler(CheckBox.UncheckedEvent, new RoutedEventHandler(Row_Checked));
                    dt.VisualTree         = fef;//添加子元素
                    column.HeaderTemplate = dt;
                    column.DataContext    = fieldCustom.Name;
                    var vc = this.tabGrid.Columns[0];
                    column.MouseLeftButtonDown += CheckLeftClick;
                    fef.SetValue(CheckBox.NameProperty, fieldCustom.Name);
                }
                indexs[a] = fieldCustom.Index;
                this.tabGrid.Columns.Add(column);
            }
            this.lst = (IList <T>)list;

            if (this.lst == list)
            {
            }
            this.Init();
        }