开发者

XtraGrid Questions

开发者 https://www.devze.com 2023-02-16 11:46 出处:网络
I have follwoing feew questions on XtraGrid (Dev Express). How to enable editing the cell by double clicking on it? by defalut XtraGrid permits cell editing if we j开发者_运维知识库ust click on it.

I have follwoing feew questions on XtraGrid (Dev Express).

  1. How to enable editing the cell by double clicking on it? by defalut XtraGrid permits cell editing if we j开发者_运维知识库ust click on it. I dont want this to be happen.

  2. How do I get the column/Row information which is edited?. Is there any event like AfterRowEdit() or AfterCellEdit()?

Thanks, Omkar


1 You could capture the click event and enable the editor if its clicked twice in a short timespan. 2 To get column/row information I would add a special editor to the column and capture its events.


  1. Try setting the OptionsBehaviour.EditorShowMode property of your view to MouseDownFocused. That way the user has to focus the cell first, and the editor will show up only on second click.

  2. Have a look at view's ValidateRow event, or if you need any processing BEFORE editing a row, you could use the view's ShowingEditor event, and grab the actual row by the view's FocusedRowHandle property.


  1. Disable the gridview editor.
  2. capture DoubleClick event on the gridcontrol.
  3. And in this event enable the gridview editor

===========

Bind each column to a repository item

  1. Go to a column and find the columnedit property.
  2. Set a repository item to that column.
  3. Then assign the validating event to the repository item.

Code:

private void your_gridcontrol_double_click(object sender, EventArgs e)
{
    GridHitInfo hit = your_gridview.CalcHitInfo((e as MouseEventArgs).Location);

    if (hit.InRow)
    {

    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消