WPF TextBlock 中的自動垂直滾動條? - Automatic vertical scroll bar in WPF TextBlock?

問題:

I have a TextBlock in WPF.我在 WPF 中有一個TextBlock I write many lines to it, far exceeding its vertical height.我給它寫了很多行,遠遠超過它的垂直高度。 I expected a vertical scroll bar to appear automatically when that happens, but it didn't.我希望在發生這種情況時會自動出現垂直滾動條,但事實並非如此。 I tried to look for a scroll bar property in the Properties pane, but could not find one.我試圖在“屬性”窗格中查找滾動條屬性,但找不到。

How can I make vertical scroll bar created automatically for my TextBlock once its contents exceed its height?一旦TextBlock的內容超過其高度,如何爲我的TextBlock自動創建垂直滾動條?

Clarification: I would rather do it from the designer and not by directly writing to the XAML.澄清:我寧願從設計者那裏做,而不是直接寫入 XAML。


解決方案:

參考一: https://en.stackoom.com/question/50BD
參考二: https://stackoom.com/question/50BD
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章