Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Sunday 4 October 2009

Saturday 17 January 2009

Investigating Silverlight Exception: System.ArgumentException: Value does not fall within the expected range

Hi,

Good to be back in action after a long break. I just found this nasty little exception when i was adding a user control to a Grid in Silverlight 2. Took me some time to understand what was happening though, until i found that it was a known issue on the silverlight forum.

I managed to get a work around that problem which i promptly shared on the same forum.

System.ArgumentException: Value does not fall within the expected range at Ms.InternalXcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

Turns out that every container needs a unique 'Name' property to be set for it's child. I have managed to get it fixed with the following self explanatory code snippet.

private static int componentID = 0;

private Grid tableGrid;

FrameworkElement element; //this is a user control.

element.SetValue(Canvas.NameProperty, GetComponentID().ToString());

private static int GetComponentID()

{

return componentID++;
}

//This will not give the 'Value does not fall within the expected range' exception.

tableGrid.Children.Add(element);

Wednesday 10 December 2008

Silverlight Toolkit - Merry Christmas!!

Go grab the silverlight toolkit from here. A newer version got released today. If you are wondering what's new,

Here, take a sneak peek

What's New?

  • More than 80 improvements and bug fixes
  • AutoCompleteBox and NumericUpDown have been moved into the Stable Quality Band.
  • Three new themes have been added: Bureau Black, Bureau Blue and Whistler Blue.
  • The sample application has been given a make-over and is now more polished and easier to navigate.
  • More tests added.
  • Better design-time support in both Visual Studio 2008 and Expression Blend, including icons, property tooltips and better property organization in the property editor.
  • AutomationPeer support added for AutoCompleteBox, Expander and NumericUpDown (as well as UpDownBase).
  • Charting improvements galore!

What's in the Silverlight Toolkit December 2008 release?

Some Links

Silverlight Tookit Quick View

Thursday 20 November 2008

Unit Testing Silverlight Apps

Inarguably SL2 applications are  a whole new experience of developing cross platform applications from managed code environments.

Unit Testing becomes very vital while developing for cross browser enterprise class applications. Visual Studio's tight integration of the Unit Testing framework is such an invaluable tool in the code production pipeline. Now, with the release of a unit testing framework for SL2 applications, the same experience can be leveraged.  SL2 applications can be developed in a test driven fashion now. It perfectly suits an agile team. A team which is constantly driven by change and is delivering on a constant basis, almost every day in some cases. Much like a team which does not have a release model. (Check out Jeff Wilcox's blog). I guess the Silverlight test framework was itself developed using an agile methodology.

The SL Unit testing framework has  proved to be an invaluable tool personally for me. It allows me to test SL applications on 3 different browsers (cheap guess if you are thinking which browsers ) even though i target IE mainly. :P.  I'll write about it with a test application soon in my next blog. Till then, check out these links..

Some Links:

Silverlight Toolkit - You can find components like dockpanel, treeview etc for SL 2, themes and of course the source code for controls with unit tests and the unit test framework itself.

Jeff Wilcox - The guy who develops actively on the SL unit test framework at MS.

Scott Gu's small demo program on SL unit testing - (If you don't know this man, you are not worth living, jump off a building NOW!)

MS Silverlight Unit Test Framework - MS unit test framework for SL 2.

Monday 15 September 2008

PRISM Guidance

PRISM is the composite application design and development guide from Microsoft Patterns & Practises for helping you build rich flexible and easily maintained WPF, Silverlight and Windows Phone apps.

Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build applications using loosely coupled components that can evolve independently but which can be easily and seamlessly integrated into the overall application.

Check out the guidance on MSDN