locked
Objects defined in the xaml not found in the .cs RRS feed

  • Question

  • What do I have to do when I have all the objects not found from the cs which are declared in the xaml.
    All my visuals objects are not found.

    I did check the namespace, I did check if all is ok in the xaml and nothing seems to be bad but

    for instead even the LayoutRoot isn't found in the .cs but the namespace is all right and there's no errors.
    What should I do ?

    The InitializeComponent is all right too.  I mean it points to the right namespace;component/Myxaml

     

    Sunday, March 28, 2010 9:38 AM

Answers

  • Ok I succeeded by deleting also the bin and obj of the project in which it was before.

    In fact what I did is to take the xaml from one project and dragged it to another one and changed the namespace everywhere accordinly .  Seems the project in which it was, was keeping something from it.

    Well, It's a lesson to learn.

    So what would be the correct course of action when you have to move one xaml from a project to another one ?

     

    Sunday, March 28, 2010 10:47 AM
  • Ok I found my mistakes guys.  It was because I was using a Silverlight Library that was trying to use a WCF service.
    NOT GOOD. 

    I did take everything that was in that library and bring it back in the Silverlight Application.  Renamed the namespace
    then deleted the obj and bin everywhere, cleaned the solution and rebuild all.  At that point I had only the ProxyCode not found error so I added my Service References and everything was compiled successfuly and now run fine.

    I think it's not a good idea to have a Silverlight Library using the WCF service.  Or it's just because I don't know how to make it work that way.

     

    Sunday, March 28, 2010 3:49 PM

All replies

  • Try to make some changes on your XAML, then save the XAML again. Or clear your obj folder. I have seen this problem when I moved Xaml file around (like copy it to a different folder).  It is the generated *.g.cs file (under your obj folder) not getting updated right.

     

     

    Sunday, March 28, 2010 9:49 AM
  • Thank you for the hint sladapter.
    Actually I did try both.  Moving a way, adding something else in the xaml, clean the solution, deleted bin adn obj and right now I have no luck !

    Sunday, March 28, 2010 10:02 AM
  •  Then just add another UserControl, copy the XAML and code over from the old one. Delete the old one.

    Sunday, March 28, 2010 10:32 AM
  • Ok I succeeded by deleting also the bin and obj of the project in which it was before.

    In fact what I did is to take the xaml from one project and dragged it to another one and changed the namespace everywhere accordinly .  Seems the project in which it was, was keeping something from it.

    Well, It's a lesson to learn.

    So what would be the correct course of action when you have to move one xaml from a project to another one ?

     

    Sunday, March 28, 2010 10:47 AM
  • Another problem I have here is

    Error 1 The type name 'ProxyCode' does not exist in the type 'Foo.bar' Reference.cs 356 78 Foo

    I mean I tried deleting the Service Reference, I did clean everything I also did delete all the obj and bin directory, I came back then re adding the Service reference. No problem detected when I add the service but I always have it not found in the Reference.cs.  I really don't know what to do now.

    Oufff it's not easy !

    Weird.  If I right click on the ProxyCode and open in Object Browser, it's really there bu the Reference.cs doesn't see it ????
    I don't even know how the Reference.cs is generated and it is located but it opends it and I see the line in which it's trying to use the Proxycode but I don't understand the reason why it doesn't see it

     

    Sunday, March 28, 2010 11:23 AM
  • Wow.  After 3 hours.  I'm giving up for the moment.  It's unbelivable.  I really don't know what to look for.
    Any help is welcome.

    private System.Collections.ObjectModel.ObservableCollection<Customer.ProxyCode.Customer_Tax> CustomerTaxesField;

    The ProxyCode is underlines in red saying :

    Error 1 The type name 'ProxyCode' does not exist in the type Customer.Customer' C:\MyWork\Silverlight\CustomerApplication\Customer\Service References\ProxyCode\Reference.cs 2035 18 Customer

    The Service Reference is there, I update it without any errors.

    I can see the service working well in the browser too

     

    Sunday, March 28, 2010 12:24 PM
  • I'm back.  Now everything compiles but I get this when the application tries to instantiate the ServiceClient by C# code

    Cannot find 'ServiceReferences.ClientConfig' in the .xap application package. This file is used to configure client proxies for web services, and allows the application to locate the services it needs. Either include this file in the application package, or modify your code to use a client proxy constructor that specifies the service address and binding explicitly. Please see inner exception for details.

    Ahhhhh what does that means again.  I never had to do it manually since 3 years doing applications.  I really don't get it.

     

    Sunday, March 28, 2010 3:28 PM
  • Ok I found my mistakes guys.  It was because I was using a Silverlight Library that was trying to use a WCF service.
    NOT GOOD. 

    I did take everything that was in that library and bring it back in the Silverlight Application.  Renamed the namespace
    then deleted the obj and bin everywhere, cleaned the solution and rebuild all.  At that point I had only the ProxyCode not found error so I added my Service References and everything was compiled successfuly and now run fine.

    I think it's not a good idea to have a Silverlight Library using the WCF service.  Or it's just because I don't know how to make it work that way.

     

    Sunday, March 28, 2010 3:49 PM