让文本从 Silverlight 中的 DataGridCell 中溢出,但不从 DataGrid 中溢出
这里有一个奇怪而具体的问题,但我试图找出一种干净的方法,让 Silverlight 中的对象(在我的例子中是 TextBlock)从 DataGridCell 中渗出,但不从包含的 DataGrid 中渗出。
例如:
[ ][ ][ ][ ]
[ ][ Bl][eed ][ ]
[ ][ ][ ][ ]
我不知道文本本身在两个不同的单元格中是什么,但我希望文本重叠。
但我想避免的是:
[ ][ ][ ][ ]
[ ][ ][ ][ Bl]eed
[ ][ ][ ][ ]
在这种情况下,我宁愿它看起来像:
[ ][ ][ ][ ]
[ ][ ][ ][ Bl]
[ ][ ][ ][ ]
目前,我尝试更改 CellTemplate,以便我的 TextBlock 包含在 PopUp 控件中,并且 PopUp 始终打开。但这不起作用,因为通过使用 PopUp,它会溢出到 DataGrid 之外。为了解决这个问题,我尝试给 DatGrid 一个 Clip 矩形,但这不起作用 - PopUp 在 DataGrid 外部仍然可见。
希望有人对此方法有一个干净而简单的解决方案。最好的情况是某种我不知道的神奇 DataGrid.ColumnSpan 或 DataGridColumn.ColumnSpan...
Sort of an odd and specific problem here, but I'm trying to figure out a clean way to have an object in Silverlight (in my case a TextBlock) bleed out of a DataGridCell, but not bleed out of the containing DataGrid.
For example:
[ ][ ][ ][ ]
[ ][ Bl][eed ][ ]
[ ][ ][ ][ ]
I don't exactly what the text itself to be in two different cells, but rather I'd like the text to overlap.
What I want to avoid though is this:
[ ][ ][ ][ ]
[ ][ ][ ][ Bl]eed
[ ][ ][ ][ ]
In this case, I'd rather it look like:
[ ][ ][ ][ ]
[ ][ ][ ][ Bl]
[ ][ ][ ][ ]
Currently, I've tried to change the CellTemplate so that my TextBlock is contained within a PopUp control, and the PopUp is always open. This doesn't work though, because by using the PopUp, it will bleed outside the DataGrid. To get around this, I tried to then give the DatGrid a Clip rectangle, but that didn't work - the PopUp is still visible outside the DataGrid.
Hoping someone has a clean and simple solution to this method. The best case would be some sort of magical DataGrid.ColumnSpan or DataGridColumn.ColumnSpan that I'm not aware of...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确的工具适合正确的工作。我切换到画布。
Right tool for the right job. I switched to a Canvas.