WPF 内置控件默认样式查看程序
查看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; }
用户评论