在WPF上使用MVVM模式时,TextBox.LineCount和TextBox.GetLastVisibleLineIndex()始终为-1 [英] TextBox.LineCount and TextBox.GetLastVisibleLineIndex() is always -1 when using MVVM pattern on WPF
问题描述
我试图从文本框中获取行数,但它总是-1,即使我调用UpdateLayout()。 textBox.GetLastVisibleLineIndex()总是返回-1。当我在ViewModel和View中调用该函数时,后面的代码。
有谁知道什么是可能的解决方案?
谢谢。
我试图从文本框中获取行数,但它总是 - 1,即使我调用UpdateLayout()。 textBox.GetLastVisibleLineIndex()总是返回-1。当我在ViewModel中调用该函数时,也会在View中调用代码。
有谁知道什么是可能的解决方案?
谢谢。
I am trying to get Line Count from textbox, but it is always -1, even if I call UpdateLayout(). The same is with textBox.GetLastVisibleLineIndex() that returns -1 always. When I call that function in ViewModel and also in View, code behind.
Does anyone know what is possible solution?
Thanks.
I am trying to get Line Count from textbox, but it is always -1, even if I call UpdateLayout(). The same is with textBox.GetLastVisibleLineIndex() that returns -1 always. When I call that function in ViewModel and also in View, code behind.
Does anyone know what is possible solution?
Thanks.
这篇关于在WPF上使用MVVM模式时,TextBox.LineCount和TextBox.GetLastVisibleLineIndex()始终为-1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!