Mega Code Archive
Dynamically Loading XAML from JavaScript
//File: Page.xaml.cs
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string xamlString = "";
UIElement element = (UIElement)XamlReader.Load(xamlString);
LayoutRoot.Children.Add(element);
}
}
}