로컬 컴퓨터에있는 리소스 사전을 사용해야합니다. 내 WPF 응용 프로그램은 Add() 또는 Remove() 메서드를 사용하여 항목을 동적으로 추가/제거합니다. 완료되면 디스크에 업데이트 된 리소스 사전을 다시 저장해야합니다.프로그래밍 방식으로 디스크에 리소스 사전 저장
직접적인 방법이 없습니다. ResurceDictionary.Save()와 같은 것이 있습니까?
로컬 컴퓨터에있는 리소스 사전을 사용해야합니다. 내 WPF 응용 프로그램은 Add() 또는 Remove() 메서드를 사용하여 항목을 동적으로 추가/제거합니다. 완료되면 디스크에 업데이트 된 리소스 사전을 다시 저장해야합니다.프로그래밍 방식으로 디스크에 리소스 사전 저장
직접적인 방법이 없습니다. ResurceDictionary.Save()와 같은 것이 있습니까?
XamlWriter
클래스를 사용할 수 있습니다.
// Get the template.
ControlTemplate template = button.Template;
// Get the XAML for the template.
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create(@"c:\template.xaml", settings);
XamlWriter.Save(template, writer);
ResourceDictionary dic = Application.Current.Resources;
StreamWriter writer = new StreamWriter("Themes\\NewOne.xaml");
XamlWriter.Save(dic, writer);
writer.Close();
모두 StringBuilder와 무슨 일이야 :
다음 파일로 버튼의 템플릿을 작성 코드 조각이야? – vidstige
아, 그리워 – EvAlex