在WPF上使用MVVM模式时,TextBox.LineCount和TextBox.GetLastVisibleLineIndex()始终为-1 [英] TextBox.LineCount and TextBox.GetLastVisibleLineIndex() is always -1 when using MVVM pattern on WPF

查看:214
本文介绍了在WPF上使用MVVM模式时,TextBox.LineCount和TextBox.GetLastVisibleLineIndex()始终为-1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图从文本框中获取行数,但它总是-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆