Hi Jenny,
to solve your problem you can use Binding instead of assign in CodeBehind.
- in page use ContentControl bound to property in DataContext <Grid x:Name="grd" HorizontalAlignment="Center">
<!-- common XAML to be shared -->
<ContentControl Content="{Binding LoadedXaml}"/>
<!-- end common XAML to be shared -->
<TextBlock FontSize="24" TextWrapping="Wrap"
Text="HTML" HorizontalAlignment="Center" Margin="114,80,114,140"/>
<TextBlock HorizontalAlignment="Left" Margin="60,115,0,0" Visibility="{Binding TbExplainVisibility}"
TextWrapping="Wrap" Text="HTML is..." VerticalAlignment="Top" Height="26" Width="148"/>
</Grid> - for complex XAML use UserControl (in file) with Command-Binding and Interactivity.dll:
- and in CodeBehind include properties for Binding and use CodeBehind as DataContext: