DevExpress GridControl单元格的内部文本可选择但不可编辑 [英] DevExpress GridControl cells' inner text selectable but not editable
问题描述
- 单击 单元格 选择它即可。复制单元格值和标题。
- 单击 两次选择内部文本。复制只复制内部文本。
我正在防止细胞版挂钩 ShowingEditor
事件,将版本设置为 e.Cancel
。
然而,这样可以防止上述行为。我想仍然可以选择要复制的内部文本,只是我希望它不可编辑。
你知道怎么做吗? Fyi,通过将 ReadOnly
设置为true,可以在列级别实现此行为:
code>< DXG:GridControl.Columns>
< dxg:GridColumn FieldName =fieldReadOnly =True/>
编辑 p>
我的网格设置如下:
< dxg:GridControl>
< dxg:GridControl.Resources>
< / dxg:GridControl.Resources>
< dxg:GridControl.View>
< dxg:GridControl.TableView>
< / dxg:GridControl.TableView>
< / dxg:GridControl.View>
< dxg:GridControl.Columns>
< / dxg:GridControl.Columns>
< / dxg:GridControl>
谢谢!
您是否尝试过
GridView.OptionsBehavior.CopyToClipboardWithColumnHeaders = False
此外,您可以尝试DevExpress建议的这种方法
当用户按Ctrl + C时,将单细胞内容从XtraGrid复制到剪贴板
GridControl is working like~ Excel natively:
- Clicking once on the cell selects it. Copy copies the cell value and the header.
- Clicking twice on the cell selects the inner text. Copy copies only the inner text.
I am working on preventing the cell edition hooking the ShowingEditor
event, setting the edition to e.Cancel
.
However this prevents the behaviour 2. above. I'd like to still be able to select the inner text for copy, just that I'd like it to be not editable.
Would you know how to do this? Fyi, this behavior can be achieved at a column level by setting the ReadOnly
to true:
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="field" ReadOnly="True"/>
EDIT
My grid is setup like this:
<dxg:GridControl>
<dxg:GridControl.Resources>
</dxg:GridControl.Resources>
<dxg:GridControl.View>
<dxg:GridControl.TableView>
</dxg:GridControl.TableView>
</dxg:GridControl.View>
<dxg:GridControl.Columns>
</dxg:GridControl.Columns>
</dxg:GridControl>
Thank you!
Have you tried
GridView.OptionsBehavior.CopyToClipboardWithColumnHeaders = False
Also you could try this approach suggested by DevExpress
Copy single cell content to clipboard from XtraGrid when user presses Ctrl+C
这篇关于DevExpress GridControl单元格的内部文本可选择但不可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!