|
|
|
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.ComponentModel; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Windows; |
|
|
|
@ -11,9 +12,10 @@ using System.Windows.Media;
@@ -11,9 +12,10 @@ using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
|
using System.Windows.Navigation; |
|
|
|
|
using System.Windows.Shapes; |
|
|
|
|
using ICSharpCode.WpfDesign.Designer.Services; |
|
|
|
|
using System.Windows.Threading; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.WpfDesign.Designer.Services; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.XamlDesigner |
|
|
|
|
{ |
|
|
|
|
public partial class DocumentView |
|
|
|
@ -25,9 +27,21 @@ namespace ICSharpCode.XamlDesigner
@@ -25,9 +27,21 @@ namespace ICSharpCode.XamlDesigner
|
|
|
|
|
Document = doc; |
|
|
|
|
Shell.Instance.Views[doc] = this; |
|
|
|
|
|
|
|
|
|
uxTextEditor.SetHighlighting("XML"); |
|
|
|
|
uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged); |
|
|
|
|
//uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
|
|
|
|
|
Document.Mode = DocumentMode.Design; |
|
|
|
|
Document.PropertyChanged += new PropertyChangedEventHandler(Document_PropertyChanged); |
|
|
|
|
uxTextEditor.TextChanged += new EventHandler(uxTextEditor_TextChanged); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void uxTextEditor_TextChanged(object sender, EventArgs e) |
|
|
|
|
{ |
|
|
|
|
Document.Text = uxTextEditor.Text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Document_PropertyChanged(object sender, PropertyChangedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
if (e.PropertyName == "Text" && Document.Text != uxTextEditor.Text) |
|
|
|
|
uxTextEditor.Text = Document.Text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Document Document { get; private set; } |
|
|
|
@ -35,9 +49,12 @@ namespace ICSharpCode.XamlDesigner
@@ -35,9 +49,12 @@ namespace ICSharpCode.XamlDesigner
|
|
|
|
|
public void JumpToError(XamlError error) |
|
|
|
|
{ |
|
|
|
|
Document.Mode = DocumentMode.Xaml; |
|
|
|
|
Dispatcher.BeginInvoke(new Action(delegate { |
|
|
|
|
uxTextEditor.ActiveTextAreaControl.JumpTo(error.Line - 1, error.Column - 1); |
|
|
|
|
}), DispatcherPriority.Background); |
|
|
|
|
try { |
|
|
|
|
uxTextEditor.ScrollTo(error.Line, error.Column); |
|
|
|
|
uxTextEditor.CaretOffset = uxTextEditor.Document.GetOffset(error.Line, error.Column); |
|
|
|
|
} catch (ArgumentException) { |
|
|
|
|
// invalid line number
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|