Thursday, April 29, 2010

Silverlight 4: Watermark property for TextBox control has not implemented.






        // Summary:

        //     Gets or sets the content displayed as a watermark in the System.Windows.Controls.TextBox

        //     when it is empty.


        // Returns:

        //     The content displayed as a watermark in the System.Windows.Controls.TextBox

        //     when it is empty.


        // Exceptions:

        //   System.NotImplementedException:

        //     API is not supported by the current platform variation.


        public object Watermark { get; set; }


Tuesday, April 20, 2010

Free Silverlight 4 Training Course



   It’s nice to be free


Monday, April 19, 2010

A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll

I continuing getting an exception in our Silverlight project:
"C# A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll"

Thanks for Sandrino who save my life by posting your solution:

Let's say you have this in your configuration file:

metadata=res://*/MyEntities.csdl|res://*/MyEntities.ssdl|res://*/MyEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=Db;Integrated Security=True;MultipleActiveResultSets=True"

And let's say your ObjectContext (in our case MyEntities) is located in the assembly: Company.Application.Repositories.

Well, then you should replace the wildcard with the assembly name in the path of the resources.


metadata=res://Company.Application.Repositories/MyEntities.csdl|res://Company.Application.Repositories/MyEntities.ssdl|res://Company.Application.Repositories/MyEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=Db;Integrated Security=True;MultipleActiveResultSets=True"

Sunday, April 18, 2010

Blend 4 RC could not load silverlight projects solution

I had just upgrading my Silverlight projects from VS2008 to VS2010, has latest Silverlight tool 4 installed. To support Silverlight 4 project editing, I also installed Blend 4 Release Candidate (RC). The upgrading projects went very smooth, and Silverlight application runs great in VS2010.

However, when I trying to open a XAML file in Blend 4 from VS2010, Blend 4 give a few project not support warning message, and then stop loading projects. I couldn’t find any project files in project tab.

After a few time trying, found an workaround:

  1. - Open solution in blend (nothing showing in project tab)
  2. - Go to “File” => “Close Project” (I am surprising that projects are opened)
  3. - “File” => “Open Project”, navigate you solution file, open it.
  4. - Now it should load all projects for you.

Here is the issue I just reported:

Hope someone found a better solution or Blend 4 team could fix this bug.

Sunday, April 11, 2010

Visual Studio 2010 offically released


Visual Studio 2010 officially released today. However, Silverlight 4 has not been delivered at same time. It will be available later this week.


Check out:

Friday, April 9, 2010

Error message when load assembly in Visual Studio 2010 Silverlight 4 project

Error 1 The "ValidateXaml" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'XXX.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'XXX.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See for more information.

A solutions posted by krohling here:

Microsoft Silverlight Media Framework - Discussions - SL4 Support:

Right click on each ***.dll file in Windows Explorer
Uncheck 'Read Only'
Click 'Unblock'

I believe this is because Windows does not initially trust files that you download from the internet.

For additional information about this: