1. 首页
  2. 编程语言
  3. C#
  4. WPF 内置控件默认样式查看程序

WPF 内置控件默认样式查看程序

上传者: 2019-04-14 09:17:13上传 ZIP文件 11.4KB 热度 42次
查看WPF Control的默认样式,有时候需要修改,可以参考默认样式,然后再作出相应的修改。 主要是代码是: var style = Application.Current.FindResource(typeof(ComboBox)); using (System.IO.MemoryStream aMemoryStream = new System.IO.MemoryStream()) { using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(aMemoryStream, System.Text.Encoding.UTF8)) { writer.Formatting = System.Xml.Formatting.Indented; System.Windows.Markup.XamlWriter.Save(style, writer); } string s = Encoding.UTF8.GetString(aMemoryStream.ToArray()); return s; } writer = new System.Xml.XmlTextWriter(aMemoryStream, System.Text.Encoding.UTF8)) { writer.Formatting = System.Xml.Formatting.Indented; System.Windows.Markup.XamlWriter.Save(style, writer); } string s = Encoding.UTF8.GetString(aMemoryStream.ToArray()); return s; }
用户评论