背景:如何阻止WPF DataGrid TextColumn單元由於換行而變長?
我有一個DataGrid與多個TextColumns。一列是隻讀的,並綁定到DataGrid外部的TextBox的文本。這個TextBox是一個多行文本框,意思是AcceptsReturn = true和TextWrapping = Wrap。
問題:
當用戶進入在多行文本框多行,結合的DataGridCell(及其排)垂直增長,因此所有顯示的文本。
問題:
- 有沒有辦法得到一個垂直滾動條在細胞內出現,當多行應該出現?
- 一般來說,由於多行內容,其他技術可以規避DataGridCell及其行的增長?
研究:
我知道我可以防止DataGridRow的成長強行設置其高度。但是,這不會觸發滾動條。
而且我確認WordWrap已關閉DataGridCell內的TextBlock。
感謝