Tuesday, October 20, 2009
Passing dates in XAML
Monday, October 19, 2009
Microsoft announce Visual Studio 2010 dates
Tuesday, October 13, 2009
Apple versus Microsoft: The top 20 stolen ideas
Monday, October 12, 2009
Silverlight ported to Linux
.NET development on the iPhone
Thursday, October 8, 2009
Silverlight Message Box
I have since taken this a step further and written a Message Box pop up user control for Silverlight using the very same framework mentioned in that blog.
An article on how I did this can be found at The Code Project.
PS. Don't forget to vote for the article.
Sunday, October 4, 2009
Microsoft WebsiteSpark
"WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others. It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the open source applications built on top of them."
Wednesday, September 30, 2009
Where is the List.Find() method in Silverlight?
Tuesday, September 29, 2009
Announcing the birth of 46Apples!
Creating pop ups with the Silverlight Toolkit
- Silverlight 3 developer runtime
- The July 2009 release of the Silverlight Toolkit for Silverlight 3
- Visual Studio 2008 SP1
Ok, now that we have the requirements out of the way, it’s ready to get dirty (well, so to speak anyway).
Create a Silverlight project in Visual Studio, and add a reference to the System.Windows.Controls assembly (should be located in your Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client directory if you have the toolkit installed).
Now add a new User Control to your Silverlight project (using the User Control template in Visual Studio). For this user control to function as a pop-up window, it needs to be panel-beated a bit. Don’t worry; it’s not as painful as it might sound!
Navigate to the new user control’s XMAL (which, in case you didn’t know, stands for eXtended Markup Application Language). Add an XML namespace definition so that it references the System.Windows.Controls as follows:and then change the opening UserControl tag to read Controls:ChildWindow. Also make sure you change the closing tag to match. Save, and then open the user control’s code-behind file (with the .cs file extension). You’ll notice that the user control currently inherits from the UserControl class. Change this so that it now inherits from the ChildWindow class. You will also have to include a using statement that references the System.Windows.Controls namespace in the user control’s code-behind.
The XAML and code-behind should look something like this:
That takes care of our new pop-up window definition. Now we need to make use of it.
Open your Silverlight application’s start up page (probably MainPage.xaml – did I guess it or did I guess it?), and navigate to the page’s code-behind. Create an instance of the pop up in the page’s constructor, and wire up an event handler for the pop up’s Closed event. After setting one or two properties, it is as simple as calling the pop up’s Show method to, well, show the pop up window. The ChildWindow class the pop up inherits from takes care of setting an opaque background, and animating the visual effect of showing the window (by using the VisualStateManager as you may have guessed).
The code-behind of MainPage.xaml looks like this:
For the purpose of the demo, I have added two buttons to demonstrate obtaining a result from the pop up after the user has closed it. The ChildWindow class provides a nullable bool property called DialogResult that can be used to determine a choice made by the user on the pop up (for example, checking whether the user clicked an Ok or Cancel button).
I have created a demo application that I will make available for download later this week. It covers the functionality described in this article, and although very simplistic, it will give you an idea of how to implement custom pop-up message boxes in your Silverlight 3 applications. The pop up in the demo looks as follows:
Happy coding
Could you do me a SOLID mate?
Wow, it’s been a while! Nearly nine years since my last blog post . A lot has changed since then – some for the better, some for the worse....
-
Introduction The purpose of this article is to introduce you to the F# language - what it is, it's origins, and how it fits into Visual ...
-
For any .NET developers new to Silverlight, they may find it strange that they are not able to resolve the Find() method when working with ...
-
Recently I had the need for an encapsulated, reusable 'About Box' control that I could use throughout a number of Silverlight applic...