What event do I have to wait for to safely access IWpfTextView.TextViewLines

150 Views Asked by At

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.

0

There are 0 best solutions below