Pages Menu
TwitterRssFacebook
Categories Menu

Posted by on 18th December, 2008

Silverlight Error when adding objects

Silverlight Error when adding objects

I have done a couple of Silverlight experiments where I programmatically generate objects on the fly and then attempt to add them to the Canvas. In one scenario, I was trying to generate 10 circles, give them some properties and then add them to the parent object, a Canvas, in this case. However, when I did this, I got the following runtime error: “{System.ArgumentException: Value does not fall within the expected range.” right when I try to add the instances to the parent (Children.Add()). I wasn’t able to find out exactly why this is happening, but after some digging, I figured that this happens because the newly created object instances have not been given a name and therefore the runtime cannot dynamically add two instances with the same name, or no names, for that matter… So, to avoid this run time exception, all you have to do is to give your newly created instances a name, thus, in our case, simply add:  e.SetValue(Canvas.NameProperty, <name>); to your loop… for (int...

Read More

Posted by on 14th December, 2008

Random animated clock

Random animated clock

I have done some code samples in Silverlight 2.0, but nothing worth sharing. So over the weekend, I saw an pretty impressive clock written in Flash and had to try to emulate some of its functionality in Silverlight 2.0. The clock can be seen here and I just loved the creativity, attention to detail and the smooth motion of the digits. For my experiment, I am only trying to (somewhat) reproduce the gyration of the number cluster, based on their location and individual rotation. Eventually, I will have more time to do it with all the digits and get it as smooth as in the Flash clock, with the subtle movements. For now, this is just a quick attempt at recreating the concept and will hopefully do… 🙂 mainpage.xaml.cs using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace SilverlightRandomClock_Fixed { public partial class Page : UserControl { public Page() { InitializeComponent(); this.animateSeconds.Begin(); } private void...

Read More

Posted by on 14th December, 2008

Simulating snow…

Simulating snow…

With the winter not bringing us any snow so far, I thought I’d make some snow myself… I had seen some implementations of “snowmaking” here and there in Silverlight 2.0, but found that some implementations were too complex for just a Sunday morning project. So I figured I’d try it myself… It is a very simple concept: generate programmatically 200 Image objects, populate them and then have one Storyboard, that fires every milliseconds, go through each one of the flakes, and move them a few pixels further down. Of course, if this were a formal project, I would have made each flake their own class etc., just like Mike did in his example, but this experiment needed to be something simple, quick and still look somewhat realistic. As you can see from the amount of code, which is relatively little, a lot more can be done here. Maybe rotate the individual flakes, take them from randomly different images, so they are not all the same and speed up some...

Read More

Posted by on 20th November, 2008

SharePoint and InfoPath Data Extraction…

SharePoint and InfoPath Data Extraction…

I have worked over the last few years much with business process automation and especially with SharePoint. Here is a somewhat straightforward solution/approach to automate a much used, but manual process in SharePoint. Let’s say you have a document library that users upload documents to. Unless you subscribe to the library and want to be notified, not much really happens when the document lands in the library. So, what if you could have SharePoint take action immediately and initiate, let’s say a Workflow, or simply store the values somewhere else, or email a user with the details…or anything else that you want? And not just with the fact that a document was uploaded (that is already built-in), but, even better, with data from the actual document… Let me walk you through the scenario: we start out with one of the sample InfoPath forms: Asset Tracking and we publish a Form Library based off this InfoPath form to SharePoint. We end up with an empty Form Library as shown below....

Read More

Posted by on 19th November, 2008

Microsoft Silverlight 2.0 Progress…

Microsoft Silverlight 2.0 Progress…

Although it is undeniable that Silverlight has made quite an impact and, apparently been embraced without much resistance, it still has a long road ahead to catch up to its rival: Flash. As Scott Gu points out in his blog, more and more Rich Internet (and non-Internet as well) Applications are being written in Silverlight and the technology is becoming mainstream with the big names. On the other hand, Flash has clearly the upper hand. More than 10 years in the business and a platform that can be embraced by non developers, gave them a long early start. Just looking at the demand for developers in either realm on Monster.com gives you the picture:  Flash (2241) vs. Silverlight (178). A few good articles comparing these two platforms can be found here, here, here and here. So, as a developer familiar with both technologies, on which one would you...

Read More

Posted by on 13th October, 2008

Microsoft Releases Silverlight 2…

Microsoft Releases Silverlight 2…

Microsoft Corp. today announced the availability of Silverlight 2, one of the industry’s most comprehensive and powerful solutions for the creation and delivery of applications and media experiences through a Web browser. Silverlight 2 delivers a wide range of new features and tools that enable designers and developers to better collaborate while creating more accessible, more discoverable and more secure user experiences. [button link=”http://www.microsoft.com/presspass/press/2008/oct08/10-13Silverlight2PR.mspx?rss_fdn=Press%20Releases” color=”#FFFFCC” size=”1″ style=”4″ dark=”1″]read...

Read More

Posted by on 14th August, 2008

Intellisense not working in Visual Studio…

Intellisense not working in Visual Studio…

IntelliSense is Microsoft's implementation of autocompletion, best known for its use in the Microsoft Visual Studio integrated development environment. In addition to completing the symbol names the programmer is typing, IntelliSense serves as documentation and disambiguation for variable names, functions and methods using metadata-based reflection." (Wikipedia) So, I can’t quite remember when exactly Intellisense stopped working for me in Visual Studio 2008, but I know I have been without (automatic) Intellisense for quite a while.When typing a dot after an object or method, it used to just show up automatically… I could however have it come up by pressing <CTRL><SPACE> and eventually got in the habit of just doing that when I needed it, without attempting to find out exactly why it was broken in the first place… So, several months later, I stumble upon an entry by Richard Fennell, who explains how to fix it. I thought I’d post it for when it breaks again, I know where to find the answer… In Visual Studio 2008, select Tools...

Read More

Posted by on 12th August, 2008

Optimizing tools for ASP.NET

Optimizing tools for ASP.NET

We all know that you can ask for directions to the same destination multiple times and get different answers each time. They will all lead you to your destination; however, some direction may get you there faster, some have a more scenic panorama, some with clear instructions and others are difficult to follow. The exact same is true for software development; each developer will write code their own way and have a reason as to why some function was written a certain way. However, with software, a key requirement is that we often don't want the elegance, the scenic nor the "pretty" code, but simply the code that executes efficiently, robustly and fast. How do you know if your code does exactly that…? You don't really know until you take your code for a test run and measure its performance… There are a ton of tools out there that will assist in giving you a diagnosis of speed, performance, etc. Morgan at PHPVS.net has written a good article highlighting...

Read More

Posted by on 11th August, 2008

Visual Studio 2008 and .NET 3.5 SP1 released

Visual Studio 2008 and .NET 3.5 SP1 released

Visual Studio Service Pack 1 and Microsoft .NET Framework 3.5 Service Pack 1 have been released today. The downloads are available here: [list style=”check”] Microsoft Visual Studio 2008 Service Pack 1 (exe) Microsoft Visual Studio 2008 Service Pack 1 (iso) Microsoft .NET Framework 3.5 Service Pack 1 [/list] “The .NET Framework 3.5 SP1 includes a lot of improvements and especially TONS (literally tons) of performance improvements for WPF applications, ADO.NET Entity Framework, ASP.NET Dynamic Data, ADO.NET Data Services Framework and much more.” PLEASE NOTE: If developing Silverlight apps with Visual Studio, please note that after installing Visual Studio 2008 SP1 you must update the Silverlight Tools (more info and download links are available here)." (via MSDN blogs –...

Read More

Posted by on 10th February, 2008

Visual Studio 2008 hotfix

Visual Studio 2008 hotfix

Visual Studio 2008 had several issues in its first release of slowing down or even freezing temporarily when developing web applications, especially large ones. This hotfix addresses some of these issues. A readme file included in the download details every issue covered in this hotfix. For more details check out Scott Guthrie’s post on this release. [button link=”https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=10826&wa=wsignin1.0″ color=”#FFFFCC” size=”1″ style=”4″ dark=”1″]read...

Read More