Load Xaml Resource Sunday Monday Tuesday Wednesday //File:Window.xaml.cs using System; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; namespace MyNameSpace.LoadXamlResource { public class LoadXamlResource : Window { public LoadXamlResource() { Title = "Load Xaml Resource"; Uri uri = new Uri("pack://application:,,,/LoadXamlResource.xml"); Stream stream = Application.GetResourceStream(uri).Stream; FrameworkElement el = XamlReader.Load(stream) as FrameworkElement; Content = el; Button btn = el.FindName("MyButton") as Button; if (btn != null) btn.Click += ButtonOnClick; } void ButtonOnClick(object sender, RoutedEventArgs args) { Console.WriteLine(args.Source.ToString()); } } }