Событие DevExpress XtraGrid RepositoryItemButtonEdit не запускается

Я добавил новый столбец ButtonEdit в свой вид сетки, я превратил кнопки в ImageButton. Я добавил событие button_click, но оно не срабатывает. Должен ли я привязывать-отвязывать что-то к моей колонке?

Вот свойства:

        // 
        // gvPrompt
        // 
        this.gvPrompt.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
        this.gcID,
        this.gcName,
        this.gcPromptFileName,
        this.gcTypeName,
        this.gcDomainName,
        this.gcPromptText,
        this.gcLanguage,
        this.gcPromptPlayType,
        this.gcDuration,
        this.colPlayPrompt});
        **this.gvPrompt.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;**
        this.gvPrompt.GridControl = this.gcPrompt;
        this.gvPrompt.Name = "gvPrompt";
        this.gvPrompt.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False;
        this.gvPrompt.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False;
        this.gvPrompt.OptionsBehavior.Editable = false;
        **this.gvPrompt.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click;**
        this.gvPrompt.OptionsCustomization.AllowGroup = false;
        this.gvPrompt.OptionsSelection.EnableAppearanceFocusedCell = false;
        this.gvPrompt.OptionsView.ShowGroupPanel = false;
        this.gvPrompt.RowHeight = 3;
        **this.gvPrompt.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowForFocusedRow;
        this.gvPrompt.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gvStep_FocusedRowChanged);**


         // 
        // colPlayPrompt
        // 
        this.colPlayPrompt.Caption = "Çal";
        this.colPlayPrompt.ColumnEdit = this.repositoryItemButtonEdit1;
        this.colPlayPrompt.FieldName = "Column";
        this.colPlayPrompt.ImageAlignment = System.Drawing.StringAlignment.Center;
        this.colPlayPrompt.Name = "colPlayPrompt";
        **this.colPlayPrompt.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways;**
        this.colPlayPrompt.Visible = true;
        this.colPlayPrompt.VisibleIndex = 9;
        this.colPlayPrompt.Width = 86;



        // 
        // repositoryItemButtonEdit1
        // 
        this.repositoryItemButtonEdit1.Appearance.Image = global::Digiturk.Diva.Management.Properties.Resources._1358361116_youtube;
        this.repositoryItemButtonEdit1.Appearance.Options.UseImage = true;
        this.repositoryItemButtonEdit1.AutoHeight = false;
        serializableAppearanceObject2.Options.UseImage = true;
        this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
        new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", 1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, global::Digiturk.Diva.Management.Properties.Resources._1358361116_youtube, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject2, "", null, null, true)});
        this.repositoryItemButtonEdit1.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
        this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1";
        this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
        **this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick);
        this.repositoryItemButtonEdit1.ButtonPressed += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonPressed);
        this.repositoryItemButtonEdit1.Click += new System.EventHandler(this.repositoryItemButtonEdit1_Click);**

выделены жирным шрифтом, что у меня есть подозрительные свойства, которые могут помешать срабатыванию события?

Спасибо за вашу помощь. С уважением, Джихат


person cihadakt    schedule 30.05.2013    source источник


Ответы (1)


Вы не можете нажимать кнопки ButtonEdit, когда представление недоступно для редактирования, поскольку в этом случае редакторы только рисуются, но не вызываются.

Задайте для свойства gvPrompt.OptionsBehavior.Editable значение true. Затем установите для свойства GridColumn.OptionsColumn.AllowEdit каждого столбца (кроме столбца с ButtonEdit) значение false. Это позволяет редактировать столбец с ButtonEdit, а кнопки редактора «кликабельны».

Также удалите строку this.gvPrompt.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click;. Это позволяет редактированию кнопки немедленно реагировать на щелчок мыши вместо того, чтобы сначала фокусировать ячейку.

person DmitryG    schedule 30.05.2013