I'm developing a Visual Studio Extension (Package), capable of interacting with Workflow Foundation 4 activities.
If the activity is opened in "code view", I'm able to access the xaml code and parse it's properties. But if the activity is opened in "design mode" i'm having trouble to access the activity elements or the xaml code.
var dte = (DTE2)serviceProvider.GetService(typeof(SDTE));
if (dte != null && dte.ActiveDocument != null)
{
String xamlPath = dte.ActiveDocument.FullName;
var document = (TextDocument)dte.ActiveDocument.Object("TextDocument");
if (document != null)
{
//Code View
var editPoint = document.CreateEditPoint(document.StartPoint);
String xaml = editPoint.GetText(document.EndPoint);
}else{
//Designer ?????
//(dte.ActiveDocument.ActiveWindow.Object.designerHostView).ContentText;
//?????
}
Can you guys give me an hint?