I have created rehosted designer studio like Visual Studio IDE. What I want to achieve, When I will modify xaml from xamlTextEditor (My costume text box) designer from center canvas should update/refresh.
designer.Xaml code
<TabControl HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.Column="1" Grid.RowSpan="2" Margin="0,22,0,5" >
<TabItem Header="Designer">
<ContentControl Content="{Binding WorkflowDesignerControl}" Margin="0,0,0,0"/>
</TabItem>
<TabItem Header="XAML"
GotFocus="RefreshXamlTabOnTabItemFocus" >
<TextBox Name="xamlTabTextBox" Text="{Binding XAML, Mode=OneWay}"
AcceptsReturn="True" TextChanged="XamlTextView_TextChanged"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" IsReadOnly="False">
</TextBox>
</TabItem>
</TabControl>
designer.xaml.cs i have property to get xaml text
public string XAML
{
get
{
if (this.workflowDesigner.Text != null)
{
this.workflowDesigner.Flush();
return this.workflowDesigner.Text;
}
return null;
}
}
I have RefreshXamlTabOnTabItemFocus
private void RefreshXamlTabOnTabItemFocus(object sender, RoutedEventArgs e)
{
this.designerViewModel.NotifyChanged("XAML");
}
Text change event
private void XamlTextView_TextChanged(object sender, EventArgs e)
{
this.workflowDesigner.Flush();
XDocument xd = XDocument.Parse(this.xamlTextView.Text);
this.workflowDesigner.Text = xd.ToString();
this.workflowDesigner.View.UpdateLayout();
}
You can see I have only one activity in Main sequence. my scenario is like
- I have updated Assign display name from designer then it will reflect in XAML text view.
- When I am modifying same display name from textbox (XAML) it's not reflecting in designer.
any one can suggest me the possible solution so I can you designer text in TwoWay?
thank you in advance.
