简体   繁体   English

如何冻结WPF网格中的列和行

[英]How to freeze columns and rows in WPF Grid

I'd like to "freeze" the columns and rows in WPF. 我想“冻结” WPF中的列和行。

I want to implement a table (state machine), where in the first row are states and in first column are commands. 我想实现一个表(状态机),其中第一行是状态,第一列是命令。 The rest of the cells are filled with events. 其余的单元格都充满了事件。 To improve usability, I'd like to keep the first row and first column visible all the time, so even at the very bottom of the table the states and commands are visible. 为了提高可用性,我想始终保持第一行和第一列可见,因此即使在表格的最底部,状态和命令也是可见的。

The DataGrid offers this kind of functionality but DataGrid cells don't look flexible enough. DataGrid提供了这种功能,但是DataGrid单元看起来不够灵活。 I'd like to use Grid. 我想使用网格。 The ScrollViewer is basically what I need, but i haven't figured out how to use it for multiple Grids at the same time. ScrollViewer基本上是我所需要的,但是我还没有弄清楚如何同时将其用于多个Grid。

Is there any way to freeze first row and first column (at the same time)? 有什么方法可以冻结第一行和第一列(同时)?

I don't think that there is no way to freeze columns or rows of a Grid. 我认为没有办法冻结网格的列或行。 But you can use 4 Grids. 但是您可以使用4个网格。 Syncronize the Column and Rowsize with SharedSizeGroup . 与SharedSizeGroup同步列和行SharedSizeGroup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM