c# - Client Side Configuration in Silverlight -
i have silverlight app. need add config settings on silverlight app. thought there app.config file add. true? if so, how config values app.config file in silverlight app?
thank you!
i don't believe supported read application settings app.config file directly in silverlight. create xml file , read settings manually (example code).
if not run standalone desktop application (out-of-browser) make use of initialization parameters (initparams msdn) can pass silverlight application using aspx page. keep dynamic, use querystring parameters.
the aspx code run silverlight application initparams:
<form id="form1" runat="server"> <div id="silverlightcontrolhost"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="xaml1" width="100%" height="100%"> <param name="initparams" value="k1=<%=request.querystring["key1"] %>,k2=<%=request.querystring["key2"] %>"/> </object> </div> </form>
then in startup module (app.xaml.cs) like:
public app() { startup += applicationstartup; } private void applicationstartup(object sender, startupeventargs e) { if (e.initparams.containskey("k1")) { var key1value = e.initparams["k1"]; } } }
Comments
Post a Comment