In addition to the platform having a release, I was really pleased to see an update to the Silverlight Toolkit, which has been one of the most popular things almost every Silverlight developer/application uses.
By default it will use Theme2.xaml as it is the last defined style. Now we’ll change the theme and use Theme1.xaml. Here is the code to change the theme dynamically from code behind.
ResourceDictionary rd = new ResourceDictionary();
//Load resource dictionary
rd.Source = new Uri("/Themes/theme1.xaml", UriKind.RelativeOrAbsolute);
//Clear previous styles if any...
//Add the loaded resource dictionary to the application merged dictionaries
Today we’ll see one simple functionality of sending email from Silverlight application. I know many of you think that it is a very simple stuff.
Let’s do it using your Outlook application. To achive this we need to use a class called AutomationFactory which is available in System.Runtime.InteropServices.Automation.AutomationFactory.
Here is the code, which is very straight forward. But remember you must have to run the application out of browser to make this work!!
You need to add
var outlook = AutomationFactory.CreateObject("Outlook.Application");
var olMail = outlook.CreateItem(0);
olMail.To = txtTOEmailAddress.Text;
olMail.Cc = txtCCEmailAddress.Text;
olMail.Subject = txtsubject.Text;
olMail.HTMLBody = txtmessage.Text;
//You can send a mail by using Send() method.
Recently I have been working with WPF. I was developing a functionality of Child window and I need to load the content of existing windows to that child window control. I got the Child Window control from the CodePlex. I think many of you must be aware of it. There is a project called Extended WPF toolkit. You can find some nice control there. Here is the code to load the content of Window object to a user control (Child Window in my case).
Window2 win = new Window2();
Grid newContent = win.Content as Grid;
win.Content = null;
ChildWin.Content = newContent;
“Window2” is the name of my window that I wanted to open in child window. The root element in the Window2 is Grid, so I cast the content as Grid and assigned it to a local variable of type Grid.
Now, note the use of: win.Content = null;
To use the content of an object we need to disconnect the content from its parent, in this case it is the instance of Window2. This line will do the trick and allow you to use the content the way you like. I have put this content to my child window’s content and that is it.
I got what I want.
You can see above, I have display the content of Window2 to my Child Window control.