Ejemplo n.º 1
0
 void InitializeState(EditorPositionState state)
 {
     textEditorControl.TextEditor.ScrollToVerticalOffset(state.VerticalOffset);
     textEditorControl.TextEditor.ScrollToHorizontalOffset(state.HorizontalOffset);
     textEditorControl.TextEditor.TextArea.Caret.Position    = state.TextViewPosition;
     textEditorControl.TextEditor.TextArea.Caret.DesiredXPos = state.DesiredXPos;
 }
Ejemplo n.º 2
0
 void TextEditor_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
     if (cachedEditorPositionState == null)
     {
         return;
     }
     InitializeState(cachedEditorPositionState);
     cachedEditorPositionState = null;
 }
Ejemplo n.º 3
0
 void TextEditor_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
     if (cachedEditorPositionState == null)
         return;
     InitializeState(cachedEditorPositionState);
     cachedEditorPositionState = null;
 }
Ejemplo n.º 4
0
 void InitializeState(EditorPositionState state)
 {
     textEditorControl.TextEditor.ScrollToVerticalOffset(state.VerticalOffset);
     textEditorControl.TextEditor.ScrollToHorizontalOffset(state.HorizontalOffset);
     textEditorControl.TextEditor.TextArea.Caret.Position = state.TextViewPosition;
     textEditorControl.TextEditor.TextArea.Caret.DesiredXPos = state.DesiredXPos;
 }
Ejemplo n.º 5
0
        public void Deserialize(object obj)
        {
            var state = obj as EditorPositionState;
            if (state == null)
                return;

            // It can't scroll until it's gotten its scrollviewer
            if (textEditorControl.TextEditor.Template == null) {
                bool start = cachedEditorPositionState == null;
                cachedEditorPositionState = state;
                if (start) {
                    textEditorControl.TextEditor.IsVisibleChanged -= TextEditor_IsVisibleChanged;
                    textEditorControl.TextEditor.IsVisibleChanged += TextEditor_IsVisibleChanged;
                }
            }
            else
                InitializeState(state);
        }