<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1944268429799294248</id><updated>2024-09-21T14:07:34.421-07:00</updated><category term="Add Image Button In Silverlight"/><category term="Passing data between pages"/><title type='text'>Silverlight Police</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://silverlightpolice.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1944268429799294248/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://silverlightpolice.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sameer S Nikam</name><uri>http://www.blogger.com/profile/18339805125614407330</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpiBkevhZ7mzg3xmxqnBi83k0-EHg4sNimPY5XHwwJb3wTVZ5uY4A_2F0YJmL7dlTq0uSZ73-KxAuW7MRTbg6VrWsonlWVMs7wZXzQF6ZNV2z5LUgu61zE5rCYWLCP-w/s220/05062011906.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1944268429799294248.post-6472555573248329967</id><published>2011-11-19T02:08:00.000-08:00</published><updated>2011-11-19T02:08:19.941-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Add Image Button In Silverlight"/><title type='text'>How to add image button Or How to add Image to Button in Silverlight?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;strong&gt;&lt;u&gt;How to add image button Or How to add Image to Button in Silverlight?&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Ans=&amp;gt; &lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;; font-size: 9pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;There is no need to add image tag or image button in the xaml file only add normal button to the xaml file like and add the image to the content property of the button it is same like Text property in .Net&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;Button.Content&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;Image&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Height&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;20&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; HorizontalAlignment&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;Left&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Name&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;imageTest&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Stretch&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;Fill&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Width&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;47&quot; &lt;/span&gt;VerticalAlignment&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;Top&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt;Source&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;D:\Projects\SilverlightApplication\Images\ABC.png&quot; /&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;Button.Content&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span&gt;&lt;span style=&quot;color: red;&quot;&gt;You can also add at runtime&lt;/span&gt;: &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Add normal button to the page like&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 8pt;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;=&quot;btnSave&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt;Uid&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;=&quot;1&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt; Width&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;=&quot;28&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 8pt;&quot;&gt; Height&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;=&quot;28&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 8pt;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;Then go to the code behind then depend on your condition you can add the following code into the various events like page load on click here I am adding image to the button in page load&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Page_Loaded(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: #2b91af;&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Uri&lt;/span&gt; urileft = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Uri&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/SilverlightApplication/Images/ABC.png&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;UriKind&lt;/span&gt;.Relative);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;BitmapImage&lt;/span&gt; imgSource = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;BitmapImage&lt;/span&gt;(urileft);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Image&lt;/span&gt; image = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Image&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;image.Source = imgSource;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;btnSave.Content = image;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;in the above code first four line is used to declare image object and to set image path then last two line is used where to add the image or we can say on which button u want to add image.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Like above code &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt; line-height: 115%;&quot;&gt;btnSave&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt; is normal button and content is property if u add &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;btnSave.Content = image; &lt;span style=&quot;color: #558ed5; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #558ED5; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=60000 lumo=40000&amp;quot;; mso-style-textfill-fill-themecolor: text2; mso-themecolor: text2; mso-themetint: 153;&quot;&gt;//then image will set into the background of button.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9pt;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Height&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;24&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Width&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;49&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; HorizontalAlignment&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;Left&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; Name&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 8pt;&quot;&gt; btnSave&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9pt;&quot;&gt; VerticalAlignment&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9pt;&quot;&gt;=&quot;Top&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://silverlightpolice.blogspot.com/feeds/6472555573248329967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://silverlightpolice.blogspot.com/2011/11/how-to-add-image-button-or-how-to-add.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1944268429799294248/posts/default/6472555573248329967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1944268429799294248/posts/default/6472555573248329967'/><link rel='alternate' type='text/html' href='http://silverlightpolice.blogspot.com/2011/11/how-to-add-image-button-or-how-to-add.html' title='How to add image button Or How to add Image to Button in Silverlight?'/><author><name>Sameer S Nikam</name><uri>http://www.blogger.com/profile/18339805125614407330</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpiBkevhZ7mzg3xmxqnBi83k0-EHg4sNimPY5XHwwJb3wTVZ5uY4A_2F0YJmL7dlTq0uSZ73-KxAuW7MRTbg6VrWsonlWVMs7wZXzQF6ZNV2z5LUgu61zE5rCYWLCP-w/s220/05062011906.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1944268429799294248.post-3263273443004895211</id><published>2011-11-18T02:03:00.000-08:00</published><updated>2011-11-18T02:11:02.762-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Passing data between pages"/><title type='text'>Using the App.Xaml for passing data between pages Or Storing And Retriving Data Globally</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;;&quot;&gt;Suppose you have created user control in that you are getting values from the database and binding it to the datagrid and same data you want to access into the main page where this user control is added or some other page.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;;&quot;&gt;So Go to the App.xaml.cs in that create public property of the List or &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ObservableCollection like:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt; OCTempTblXyzDetail { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblPQRDetail&lt;/span&gt;&amp;gt; OCTempLocationMasterDetail { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;in the above line &lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail &amp;amp; TblPQRDetail &lt;/span&gt;is my Class(i.e. view which is added into the edmx.)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;after that initialize this object in startup event like&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Application_Startup(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: #2b91af;&quot;&gt;StartupEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #00b050; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //following lines are important to initialize the object.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCTempTblXyzDetail = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;Web.Models.&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCTempLocationMasterDetail = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bservableCollection&lt;/span&gt;&amp;lt;Web.Models.&lt;span style=&quot;color: #2b91af;&quot;&gt;TblPQRDetail&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Net.&lt;span style=&quot;color: #2b91af;&quot;&gt;WebRequest&lt;/span&gt;.RegisterPrefix(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;http://&quot;&lt;/span&gt;, System.Net.Browser.&lt;span style=&quot;color: #2b91af;&quot;&gt;WebRequestCreator&lt;/span&gt;.ClientHttp);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;// This will enable you to bind controls in XAML files to WebContext.Current&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// properties&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Resources.Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;WebContext&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;WebContext&lt;/span&gt;.Current);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// This will automatically authenticate a user when using windows authentication&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// or when the user chose &quot;Keep me signed in&quot; on a previous login attempt&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;WebContext&lt;/span&gt;.Current.Authentication.LoadUser(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Application_UserLoaded, &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// Show some UI to the user while LoadUser is in progress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.InitializeRootVisual();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;After this go to the Usercontrol.cs page in that create object of the app.xmal like&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; UserControl_Loaded(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: #2b91af;&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here I am creating object of the app.xmal page&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; App&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; app = (&lt;span style=&quot;color: #2b91af;&quot;&gt;App&lt;/span&gt;)&lt;span style=&quot;color: #2b91af;&quot;&gt;Application&lt;/span&gt;.Current;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here i am creating the new public&amp;nbsp;property of the observable collection and also initializing &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt; OCTblXyzDetail { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;OCTblXyzDetail = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here I am initializing the object of the app.xmal page&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; app.OCTempTblXyzDetail = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt;();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;So you can access public variables, objects and functions etc. after that assign the data to the OCTempTblXyzDetail &amp;nbsp;object of the app.xaml.cs like&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;Here OCTblXyzDetail is my main object of the user control in that I am storing the databse values at the time of page load. Like &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; GetAllAttributeNameByDataDimensionIDQuery_Complete(&lt;span style=&quot;color: #2b91af;&quot;&gt;LoadOperation&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt; operation)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (!operation.HasError)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCTblXyzDetail = operation.Entities.ToObservableCollection();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (OCTblXyzDetail.Count &amp;gt; 0)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;Datagrid.ItemsSource = OCTblXyzDetail;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;color: #92d050; font-family: Consolas; font-size: 9.5pt;&quot;&gt;//follwoing line is used to assign the data to the object of the app.xaml page&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;app.OCTempTblXyzDetail = OCTblXyzDetail;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;;&quot;&gt;Now you can get the data from anywhere in application. Here I am retrieving &amp;nbsp;this data into the my &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #558ed5; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #558ED5; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=60000 lumo=40000&amp;quot;; mso-style-textfill-fill-themecolor: text2; mso-themecolor: text2; mso-themetint: 153;&quot;&gt;main&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #558ed5; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #558ED5; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=60000 lumo=40000&amp;quot;; mso-style-textfill-fill-themecolor: text2; mso-themecolor: text2; mso-themetint: 153;&quot;&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;page&lt;/b&gt; &lt;/span&gt;here also you have to create the object of the app.xaml page like&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Page_Loaded(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: #2b91af;&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;//here I am creating object of the app.xmal page&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;App&lt;/span&gt; app = (&lt;span style=&quot;color: #2b91af;&quot;&gt;App&lt;/span&gt;)&lt;span style=&quot;color: #2b91af;&quot;&gt;Application&lt;/span&gt;.Current;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 9.5pt;&quot;&gt;ObservableCollection&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; OCTblXyzDetail = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TblXyzDetail&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;color: #6fa8dc; font-family: Consolas; font-size: 9.5pt;&quot;&gt;//Following line is used to get data from the object of the app.xaml &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;OCTblXyzDetail &lt;span style=&quot;color: #c0504d; mso-themecolor: accent2;&quot;&gt;=&lt;/span&gt;app. OCTempTblXyzDetail.ToObservableCollection();&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;Now you can use OCTblXyzDetail to bind to the list or to data grid. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://silverlightpolice.blogspot.com/feeds/3263273443004895211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://silverlightpolice.blogspot.com/2011/11/using-appxaml-for-passing-data-between.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1944268429799294248/posts/default/3263273443004895211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1944268429799294248/posts/default/3263273443004895211'/><link rel='alternate' type='text/html' href='http://silverlightpolice.blogspot.com/2011/11/using-appxaml-for-passing-data-between.html' title='Using the App.Xaml for passing data between pages Or Storing And Retriving Data Globally'/><author><name>Sameer S Nikam</name><uri>http://www.blogger.com/profile/18339805125614407330</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpiBkevhZ7mzg3xmxqnBi83k0-EHg4sNimPY5XHwwJb3wTVZ5uY4A_2F0YJmL7dlTq0uSZ73-KxAuW7MRTbg6VrWsonlWVMs7wZXzQF6ZNV2z5LUgu61zE5rCYWLCP-w/s220/05062011906.jpg'/></author><thr:total>1</thr:total></entry></feed>