Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

wpf - How can i serialize xaml "Brush"? -


how can or best method serialize system.windows.media.brush ?

here discussion of how serialize wpf:

http://statestreetgang.net/post/2008/06/xaml-serialization-ftw.aspx


/// <summary> /// serializes specified object /// </summary> /// <param name="toserialize">object serialize.</param> /// <returns>the object serialized xaml</returns> private string serialize(object toserialize) {     xmlwritersettings settings = new xmlwritersettings();     // might want wrap these in #if debug's      settings.indent = true;     settings.newlineonattributes = true;     // gets rid of xml version      settings.conformancelevel = conformancelevel.fragment;     // buffer stringbuilder     stringbuilder sb = new stringbuilder();     xmlwriter writer = xmlwriter.create(sb, settings);     // need moar documentation on manager, plox msdn     xamldesignerserializationmanager manager = new xamldesignerserializationmanager(writer);     manager.xamlwritermode = xamlwritermode.expression;     // extremely rare throw exception     xamlwriter.save(toserialize, manager);      return sb.tostring(); }  /// <summary> /// deserializes object xaml. /// </summary> /// <param name="xamltext">the xaml text.</param> /// <returns>the deserialized object</returns> /// <exception cref="xmlexception">thrown if serialized text not formed xml</exception> /// <exception cref="xamlparseexception">thrown if unable deserialize xaml</exception> private object deserialize(string xamltext) {     xmldocument doc = new xmldocument();     // may throw xmlexception     doc.loadxml(xamltext);     // may throw xamlparseexception     return xamlreader.load(new xmlnodereader(doc)); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -