private static UIElement Read(string path) { using (var stream = File.OpenRead(path)) { Throws.IfNot(stream != null, "The requested file is not exist."); // создаем экземпляр return((UIElement)XamlConfigurationParser.LoadFrom(stream)); } }
protected T GetXaml <T>(string path) { using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream(path)) { Throws.IfNot(stream != null, "The requested file is not found in embedded resource."); // создаем экземпляр return((T)XamlConfigurationParser.LoadFrom(stream)); } }