locked
Silverlight controls in VS2010 toolbox RRS feed

  • Question

  • Is there a way to change the default xmlns used by Visual Studio when Silverlight controls are added from the toolbox? For example, when I add a DataGrid control the namespace xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" is automatically added to the page. I would like to change it so the namespace xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" is used instead.
    Tuesday, May 11, 2010 3:18 PM

Answers

  • Nevermind. I just installed the new version of SL4 Tools that was released yesterday and that fixed the namespace issue. Maybe it was just a bug in the release candidate.
    Tuesday, May 18, 2010 11:30 AM

All replies

  •  It should be using whichever reference is included in your references folder, which is where the controls are coming from. I don't see how your proposed namespace would even work, especially if it does not contain a datagrid definition or assembly reference. The controls you have access to are referenced from the dlls you have included/referenced in your project. Changing the namespace in that case would likely cause no control to be referenced or usable.

     

    What  is the purpose for doing this? Or what are you trying to accomplish?

    Wednesday, May 12, 2010 11:01 AM
  • devdmans - It is a valid namespace for Silverlight 4. See http://msdn.microsoft.com/en-us/library/dd728664(VS.95).aspx#xaml_for_sdk_client_libraries.
    Wednesday, May 12, 2010 11:20 AM
  •  right. but Im not sure on this statement and if it can actually integrate into the designer itself..  so im not sure. ill watch this thread tos ee if there is anymore input on this topic.

    'Rather than using Toolbox and the Silverlight visual designer for Visual Studio 2010, you can also manually define your own mapping for http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk, and use that XAML namespace's mapping to reference SDK client types from your XAML.'

    Wednesday, May 12, 2010 2:11 PM
  • What he is asking is if the default namespace can be changed when dragging a control from the toolbox to the xaml editor.

    To be honest I don't see why this is important... You can always change it by yourself after adding the control you the editor surface

    Wednesday, May 12, 2010 2:49 PM
  • Hi Angiel,

    With Silverlight 3 and previous, its namespace should start with data etc. What I want to say is that it is  a change that some of the developers think it is great while others don't think so.  However, you can change it manually.   Thanks for your post.

    Best regards,

    Jonathan

    Tuesday, May 18, 2010 5:06 AM
  • Jonathan, I'm not sure you understood my post. According to the documentation it looks like controls from the VS toolbox should automatically use the new namespace xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" but that is not happening for me. I don't understand why Microsoft would add this feature to Silverlight but not support it with the tooling. Can you tell me if there are any plans to fix this item in the future? Thanks
    Tuesday, May 18, 2010 9:31 AM
  • Nevermind. I just installed the new version of SL4 Tools that was released yesterday and that fixed the namespace issue. Maybe it was just a bug in the release candidate.
    Tuesday, May 18, 2010 11:30 AM
  • Hi Angiel,

    Yes.  This has been fixed in Silverlight RTW.

     

    Maybe it was just a bug in the release candidate.

    I would believe that it is a change. Anyway,  it works as your desired. 

    Best regards,

    Jonathan

    Wednesday, May 19, 2010 5:40 AM