//File:Window.xaml.vb Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Media Imports System.Windows.Markup Imports System.Xml Imports System.IO Namespace WpfApplication1 Public Partial Class Window1 Inherits System.Windows.Window Public Sub New() InitializeComponent() Dim sr As New StringReader("") Dim reader As XmlReader = XmlReader.Create(sr) Dim dynamicButton As Button = DirectCast(XamlReader.Load(reader), Button) Me.grid1.Children.Add(dynamicButton) AddHandler dynamicButton.Click, AddressOf button1_Click End Sub Private Sub button1_Click(sender As Object, e As RoutedEventArgs) MessageBox.Show("Dynamic Button Loaded From XAML String") End Sub End Class End Namespace