我必须等待什么事件才能安全访问 IWpfTextView.TextViewLines
我开始为 VS 编辑器编写一个装饰器,并且我的数据很大程度上基于行号,因此我需要访问 IWpfTextView 上的 TextViewLines 属性来计算我的装饰器集。
但是,当调用 TextViewCreated 时,该属性仍然为 Null。
我尝试等待第一次调用 OnViewLayoutChanged,实际上该属性当时不为空,但行数为“2”,对于 50 行文件,似乎只是前两行。
我需要什么时间才能获得完全初始化的 TextViewLines,该 TextViewLines 实际上反映了完整的文件内容?或者我误解了我应该得到什么?
这适用于 VS2010 SP1 上的 csharp 内容类型。
I'm starting out writing an adorner for the VS editor and my data is heavily based on line numbers, so I need access to the TextViewLines property on IWpfTextView to calculate my set of adorners.
However, when TextViewCreated is called, the property is still Null.
I tried instead waiting for the first call to OnViewLayoutChanged, and indeed the property wasn't null at that time, but the count of lines was '2', for a 50 line file and appeared to just be the first two lines.
What's the timing I need here to get a fully initialised TextViewLines that actually reflects the full file content? Or am I misunderstanding what I'm supposed to get?
This is for the csharp content type on VS2010 SP1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论