Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DevExpress XtraGrid RepositoryItemButtonEdit event is not firing

I have added a new ButtonEdit column to my gridview, I turned buttons to ImageButton. I added button_click event but event is not firing. Should I bound - unbound something to my columnbutton?

Here are the properties:

        // 
        // 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);**

bolded lines that I got suspicious properties which may prevent event firing?

Thanks for your help. Regards, Cihat

like image 364
cihadakt Avatar asked May 30 '13 08:05

cihadakt


1 Answers

You can't click the ButtonEdit buttons when the view is not editable because the editors only drawn but not invoked in this case.

Set the gvPrompt.OptionsBehavior.Editable property to true. Then, set each column's (except the column with the ButtonEdit) GridColumn.OptionsColumn.AllowEdit property to false. It allows the column with the ButtonEdit to be editable and the editor's buttons to be "clickable".

Please also remove the this.gvPrompt.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click; line. It allows the button edit to react on mouse click immediatelly instead of focusing cell first.

like image 97
DmitryG Avatar answered Sep 22 '22 14:09

DmitryG