2013-05-30 46 views
6

Tôi đã thêm cột ButtonEdit mới vào GridView của mình, tôi đã chuyển các nút thành ImageButton. Tôi đã thêm sự kiện button_click nhưng sự kiện không kích hoạt. Tôi có nên ràng buộc - không gắn kết thứ gì đó với nút bấm của tôi không?DevExpress XtraGrid RepositoryItemButtonSự kiện chỉnh sửa không kích hoạt

Dưới đây là các thuộc tính:

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

dòng in đậm mà tôi có đặc tính đáng ngờ nào mà có thể ngăn chặn sự kiện bắn?

Cảm ơn sự giúp đỡ của bạn. Trân trọng, Cihat

Trả lời

13

Bạn không thể nhấp vào nút ButtonEdit khi chế độ xem không thể chỉnh sửa được vì trình chỉnh sửa chỉ được vẽ nhưng không được gọi trong trường hợp này.

Đặt thuộc tính gvPrompt.OptionsBehavior.Editable thành true. Sau đó, đặt từng cột (trừ cột có thuộc tính ButtonEdit) GridColumn.OptionsColumn.AllowEdit thành false. Nó cho phép các cột với các ButtonEdit có thể chỉnh sửa và các nút của trình soạn thảo để được "có thể nhấp".

Vui lòng xóa đường dây this.gvPrompt.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click;. Nó cho phép các nút chỉnh sửa để phản ứng trên nhấp chuột chuột immediatelly thay vì tập trung tế bào đầu tiên.

+1

cảm ơn bạn rất nhiều vì sự giúp đỡ của bạn. Nó hiện đang hoạt động – cihata87

+0

Tác phẩm của nó Cảm ơn rất nhiều DmitryG – Khalid

Các vấn đề liên quan