I tried to use this link: http://msdn.microsoft.com/en-us/library/ff407130.aspx . But whenever I debug it for some reason it throws an error :
The type 'src:MyVirtualizingStackPanel' was not found. Verify that you
are not missing an assembly reference and that all referenced
assemblies have been built.
And another error:
'src' is an undeclared prefix. Line 13, position 22.' XML is not valid
I copied the class and methods into the MainWindow class and the XAML.
Am I missing anything here?
At the end of the day, you are mistaken about your XML Namespace. If you type your error minus the name into a search engine, you will see something:
The type was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built
All of the results will point to the fact that you have not provided the correct XML Namespace for your project. Now we don't have your project in front of us... only you do, so only you can work out what your Namespace problem is. You mentioned something in a comment that made me suspicious.
You said The name-space is set automatically, but when I asked you to tell me exactly what that meant, you didn't, so I still don't know what you meant. Either way, it doesn't matter, but that could be a cause of your problem. Here are some other possible causes:
Maybe your MyVirtualizingStackPanel class is defined in a different class/project to where you specified.
Maybe you need to include the assembly=XXX part of the XML Namespace.
Maybe you have not included the CLR Namespace in your MyVirtualizingStackPanel class.
Either way, this is definitely an XML Namespace problem, so just keep looking/experimenting and you'll find the problem eventually. You can find out exactly how to add an XML Namespace from the XAML Namespaces and Namespace Mapping for WPF XAML page on MSDN.
Yes, you need to specify the namespace where the MyVirtualizingStackPanel class comes from.
In the beginning of your XAML, add:
xmlns:src="clr-namespace:XXX"
where XXX is the namespace.
See MSDN.
You have to import in the xaml the namespace srcto use this
On the top of the page you do:
xmlns:src="yourProjectPath"
than you can use the MyVirtualizingStackPane class.
add the XMLNS in the top,
Here look at the example
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Add a reference to 'PresentationFramework' - you will find it in:
Add reference... -> Assemblies -> Framework
Related
I have a C# project with two namespaces in one solution. I've documented all the classes/functions/members/etc in both namespaces. As this project is a small research project, the namespaces are DocTestLibrary and DocTestLibrary.Events. However, when I try to create documentation from it via Sandcastle, it will only create documentation for the DocTestLibrary namespace. Is there any setting that I need to make in Sandcastle to make this work? I doubt it though, as I've scoured through most of them.
The strange thing is, Doxygen is able to generate documentation just fine.
As to provide some more information, I've checked the log that Sandcastle produces for the build.
It seems that this entry is causing the rest not to be displayed.
Warn: ResolveReferenceLinksComponent2: Unknown reference link target 'T:DocTestLibrary.Events.DemoEvent'.
I also found out something else.
The DocTestLibrary namespace consists of two classes:
TestClass
StaticHelper
As the name implies, the StaticHelper is a helper-class with only static methods. Yet Sandcastle also denies to process this file. Only the TestClass get's processed. It only boggles me that there isn't an entry about this in the log though.
In my sandcastle project it would always only include a single namespace of a total 5. The problem was that I did not check Include root namespace container under the section Help File.
Now all my namespaces are listed unter a root namespace.
Are all your types in DocTestLibrary.Events internal by any chance? By default, I believe Sandcastle only generates documentation for public types.
I've found this issue can be fixed by manually setting the classes you want documented in Edit API Filter under Project Properties -> Visibility.
It seems that this issue is fixed by setting the DocumentInternals in the Visibility properties section in the Sandcastle project. I wonder why this is, as no code is declared internal...
I guess I'll be playing around some more...
I've already wasted a few hours on this one:
XmlSerializer serializer;
YES, the using is there, the reference is there, I made the entire solution in VS2010 using .NET 4.0 so it's not any of those things. If I go in Object Explorer I can find the XmlSerializer class I want in the correct namespace but if I try typing the above line in to my code file and compiling I get the dreaded
The type or namespace name 'XmlSerializer' could not be found (are you missing a using directive or an assembly reference?)
warning of death. I don't get it on IntelliSense either. All other threads/websites I've looked on have come up blank or with one of the solutions I've already ruled out. What am I missing?
Cheers
Do you build a Silverlight app?
Silverlight has XmlSerializer defined inside System.Xml.Serialization.dll assembly which is not referenced by default.
This often leads to confusion because other framework versions have it defined in System.Xml.dll.
You need to add System.Xml.Serialization.dll to project references to wire it up.
I had the same problem.
Go to Object Explorer, select XmlSerializer and choose copy. Then, paste into code
This helped me with some weird reason (no there wasn't a typo or anything like that).
Error 7 The type or namespace name
'SampleMain' does not exist in the
namespace
'System.Windows.Forms.DataVisualization.Charting.Utilities'
(are you missing an assembly
reference?)
i am getting this error on this line:
System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;
what am i doing wrong?
If you need help figuring out the 'structure' of the namespaces, use the Object Browser from within Visual studio or use Reflector to view what's within the
System.Windows.Forms.DataVisualization.Charting.Utilities
namespace. This may help you gain an understanding as to what you can and cannot access within each.
I get this error when I have no reference to the library in the "References" folder in my project. Check and make sure you are referencing it by clicking on the + next to the References folder and expanding the list.
Some of the libraries require you to explicitly reference them, even if they are contained in a namespace you are already referencing.
Edit: Also, make sure that the namespace/class you are trying to use really exists.
Edit: 'SampleMain' may not even be a good object to use. Found this that suggests that you shouldn't reference sample environment classes: http://social.msdn.microsoft.com/Forums/en/MSWinWebChart/thread/26aac6f7-d3bf-492f-bb52-dc88477f1b1b
Did you add the dll reference to your project?
click on the + next to Reference to see if you have included the correct namespaces/assemblies
You're getting this error because you've referenced a type with the following name that the compiler cannot find
System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm
The most likely causes for this issue are
It exists but it's in a DLL that you haven't referenced in this project. Check the references of the project and make sure the DLL that contains the type is listed
The type name is simply incorrect. Could be a typo or a just a wrong namespace in the name.
The SampleMain type does not exist in System.Windows.Forms.DataVisualization.Charting.Utilities namespace.
Always check that you do not have one of your projects set to the client profile. That will cause this same sort of behavior.
This is in reference to a problem I had which I was able to find the solution to here on Stack Overflow.
This wasn't my question, but it was the same exact problem I had. How do I know that I need to import a specific DLL file to use a specific namespace? I saw no reference to this on either the MSDN page or the Object Explorer, and even ReSharper didn't pick up on it. Is this referenced anywhere?
From http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx:
DataContractJsonSerializer Class
Serializes objects to the JavaScript Object Notation (JSON) and deserializes JSON data to objects. This class cannot be inherited.
Namespace: System.Runtime.Serialization.Json
Assembly: System.ServiceModel.Web (in System.ServiceModel.Web.dll)
Good question. I generally do a quick search for the class on Google, then start typing for the assembly based on the beginning of the namespace it's in.
When you look up the namespace on MSDN, most classes specify the assembly where it resides.
In reference to your previous question:
MSDN Reference
Near the top you get your answer:
Namespace: System.Runtime.Serialization.Json
Assembly: System.ServiceModel.Web (in System.ServiceModel.Web.dll)
I'm using a MS namespace but Visual Studio is telling me I don't have a reference to it. Is there a place you can go to and lookup namespaces?
Thanks
If you mean "to find which dll I need (per-type)": MSDN?
For example, CLSID
Namespace: Microsoft.Aspnet.Snapin
Assembly: AspNetMMCExt (in AspNetMMCExt.dll)
You can normally find the MSDN page about a specific namespace by going to http://msdn.microsoft.com/namespace. So, for example, to find out about System.Web you could go to...
http://msdn.microsoft.com/system.web
That in itself doesn't help you. You'll need to click through from there to the specific types you're using, and it'll tell you (near the top) the name of the DLL that implements the type.
Remember that a namespace can contain types that are defined in more than one DLL.
See http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx for how to add a reference
You will also need the assembly.
For Microsoft and System namespaces the easiest way is http://msdn.microsoft.com/library or, if MSDN installed locally, its index.
If you want to know which assembly a certain class is located in you can simply check the documentation (it's noted on the class overview page of the class). Note that one namespace might very well be spread out over more than one assembly.
You need to first add reference to the DLL before using it in your code with the 'using' keyword.
Right click the project > add reference > in the .Net tab select the component and click ok. Then build your code.
You can't find the DLL for a specified namespace in all cases because multiple types belonging to the same assembly may reside in different assemblies.
The fastest way to get there would be to google to the MSDN page for the specific type (class) you are using. Let's say XDocument.. I put `msdn xdocument class' into google. First result is the page I need. Click!
Under the class name you'd see a section like this
Namespace: System.Xml.Linq
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
This shows you the namespace that the type belongs to (for which you may need to add a using in your code)
and the DLL you need to 'Add Reference' to.