Silverlight Designer not finding custom controls - silverlight

I'm having an issue where silverlight doesn't recognise custom controls or resources.
I include the namespace and intelisense recognises the item, the application builds fine and runs fine however the designer throws the following error.
The type 'x' was not found. Verify that you are not missing an assembly reference
and that all referenced assemblies have been built.
Usually I'm able to sort out the issue by performing a clean/rebuild of the project. however recently this route has been unable to resolve the issue.
Is this a known issue with the Visual Studio designer? are there any fixes/work arounds out there?
Thanks
EDIT:
I'm using the following declaration:
xmlns:converters="clr-namespace:x.Classes.Converters"
and referencing the control using the following:
<converters:ReportTypeImageConverter x:Name="ReportTypeImage"/>
Restarted visual studio this morning when I logged in and now its recognising the controls, which means I can use the designer again.

Try to go to your Project Properties and put some Reference Paths(folders where you .dll are)
Hope it Helps

Related

DataGrid2D - 'Attachable Property' warning in VS 2019

I'm using the DataGrid2D component (installed via NuGet) to allow me to bind a 2D array to a datagrid in a .Net Core 3.1 WPF project using Prism.
https://github.com/GuOrg/Gu.Wpf.DataGrid2D/blob/master/README.md
Everything works it's just that the designer breaks and VS gives me the following warning for the code snippet shown below:
The Attachable Property 'Array2D' was not found in type 'ItemSource'
Here's the alias I included in the top of the xaml page:
Any ideas how to resolve this?
Sadly I think this may be just one of countless bugs in the WPF designer.
Does it work when you run it?
You can try a sad loop of closing vs, git clean, rebuild etc. and maybe it goes away.

Error in Visual Studio 2017 trying to reference the WPF Extended Toolkit in XAML

I am attempting to use the WPF Extended Toolkit. I downloaded it and it is currently sitting in my project folder.
I right clicked the .dll file and checked "Unblock" following this answer. I have it referenced in my Visual Studio project.
I have it named WPF Extended Toolkit in my Toolbox.
I have the namespace in my XAML file.
When I try to use it in my XAML file, I'm getting the blue squiggly line stating, "The type toolkit:BusyIndicator was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."
I'm very new to this, since I've only used what was available by default in WPF apps. Can someone tell me what I'm doing wrong? I thought I covered everything needed to get this going.
I figured it out! I found this answer!
Before adding the namespace, I rebuilt my project, then I added the namespace. IntelliSense picked it up and I was able to add my Busy Indicator.

Visual studio 2012 XAML designer invalid markup

I've got a project that contains usercontrols. For some reason, the design view for the window which uses the said controls has stopped functioning and insists on "Invalid Markup" - the error given is that some members of the usercontrols are not recognized or not accessible. The project however compiles and executes just fine. Loading it up in VS2010, the editor works fine, no errors whatsoever - the same even in Expression Blend.
So far I have tried the typical clean, rebuild, manually deleting stuff from obj, updating the .xaml and rebuilding, tried starting VS2012 with /resetuserdata and /resetsettings - the problem persists. I even rolled back to a much older revision of my project, back when the designer was working just fine, no dice - same error. I also tried launching VS2012 as a new windows user to avoid any stored appdata that might be lingering, again a no go.
Is there some other sort of cache or something that I could manually delete?
There's also an issue with the ShadowCache (used for rendering designer) getting out of sync with your XAML in VS2012. I just found this out, as I was having a horrible time with the following error with derived user controls:
The local property XXXX can only be applied to types that are derived from YYYYY.
The shadow cache is located in your user profile directory:
app data\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache
You can delete everything in there and restart VS2012. After that, things worked much better (for at least a while!)
Delete everything in ShadowCache
C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
Copy-pasteable paths
Just copy/paste one of these paths into Windows Explorer. %LOCALAPPDATA% is a Windows Environment Variable it will be replaced with the corresponding value when entered into Explorer (also works in Command Prompt)
VS2012
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
VS2013
%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache\
VS2015
%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache\
ASP.NET
If you develop ASP.NET also delete
%LOCALAPPDATA%\Microsoft\WebsiteCache
%LOCALAPPDATA%\Temp\VWDWebCache
I'm not sure this will fix all cases but this is what worked for me (all the time now).
I have VS2012, using the Blend designer in the IDE, building an x64 application, when I would define a new ICommand and add the Command attribute, I would get the designer isn't supported in x64 error (I forget the exact warning). If I switch to x86, I'd get invalid XAML markup errors complaining the the ICommand wasn't recognized or was not accessible, no matter how many times I rebuilt in x64. If I switch to x86, build, then switch back to x64, voila, not problems with the designer.
Now I recall similar issues with VS2008 and Blend version 3 and 4. From what I've read in other posts, using Any CPU might also resolve the issue.
May be you have added user controls which are not supported or you might have added some wrong parent-child relationship in your user controls . Try removing the suspected User Controls and rebuilding the project . It must fix the issue .
Cheers
You need to re:encode your xaml, open bugged files in ide -> save as -> save encoded (choose UTF8)
I've the same problem while using controls with a custom (no param) Constructor.
Check if the Custom/User Control constructor doesn't require any data that the WPF designer doesn't have. A quick wait to check that is surrounding the whole thing with a try catch, cleaning, rebuilding and then check to see if the problem is solver.
If it is not, try commenting everything except the default WPF Init cod, clean, rebuild and test it out.
In Visual Studio 2013 this is a workaround I using for my Windows Phone Project, http://danielhindrikes.se/visual-studio/workaround-for-invalid-markup-problems-when-developing-for-windows-phone/. I guess it is the same designer that is used when you writing XAML for WPF.
Have tried to delete Shadow Cache but itjust work first time I start Visual Studio, above workaround is the only thing that helped me.
A little late, but something else to consider: If your no-parameter constructor is doing some other work, like getting data that doesn't exist because you are in the designer, add this at the start of your constructor:
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;
// Do work.
This is necessary because the designer does execute your no-parameter constructor which may fail in design mode an give you the invalid markup.
And, regardless of what others are saying, this is not a VS or WPF XAML Parser bug. I ran into this issue today using VS 2015, .Net 4.5.2.
I just had the same problem (program compiling and running fine, XAML designer reporting invalid markup), the issue was that I had accidentally changed the assembly name of one of the projects in my solution, I changed it back and my XAML designer sprang back to life, so check the Properties page of each project in your solution, and ensure the Assembly Name is as you expect it to be.
I think there is no problem in your project, but it is problem in VS 2012. Try to install the latest update for VS 2012 (Update 2) and also check this answer.
Regards,
I have the same Problem with VS 2015 and 2017 but only if I compile for x64 only.
Here it helps if I change compile target (Project properties - Build, its called Plattformziel in german) temporarily to x86, compile to project and switch back to x64.
Maybe this is a "solution" for anybody else.

The tag "xxx" does not exist in XML namespace"yyy" / Reference could not be found

I have a winform usercontrol than I want to add to wpf project.
I added the relevant references (WindowsFormsIntegration, SystemWindowsForms and my user control dll) and added this row in my XAML:
xmlns:MyControl="clr-namespace:xx.xx.xx;assembly=xx.xx"
And then this:
<WindowsFormsHost><MyControl:control></MyControl:control></WindowsFormsHost>
When I write "MyControl:" the "control" is automated show up that mean VS recognize the control and all references added ok... but when I compile the project this give me the error in the title.
Edit
Its very strange when I'm compile the all project i've got error "The type or namespace name "xx' could not be found..."
but I added all the refernces and the VS recognize the namespace so why the compiler don't found them? If this problem will be solved I beleive the other problem also will disappear.
The solution is: Go to your project properties and change the Target Framework from Client Profile to the full version of the .Net you are using, see the image below. This problem happens if your DLL targets the full .NET Framework, and your WPF Application (main project) targets .Net Client Profile.
This happened to me when I included the assembly name in the namespace definition, but both controls were in the same assembly. Just removing the assembly part of the namespace declaration solved it.
Visual Studio will load the reference only for reflection so it will show correct intellisense correctly. But in order to compile, compiler will need all the dlls that your referenced dll is dependent on. So visual studio will show intellisense for mycontrol as it can find it in reference. But your myontrol may reference other dlls which you may not have added. You will have to add dependent references of mycontrol in your project too.
It could also be that the target framework is different between your projects. We host a class library dll with the WPF pages, and it was targeted to 'Any CPU', but the host application was targeted to 'x86'. Once they matched, the problem went away.
I ran into the same "The type or namespace name 'xx' could not be found..." issue.
It disappears when I moved my Visual Studio files on a local drive. They were stored on a shared network directory before. I dont know the root cause of this, but at least I can have my designer running now.
I've encountered this problem before and replacing <MyControl:control></MyControl:control> with just <MyControl:control/> fixed it for me.
No idea why though. It seems like the first form is only for controls which can contain other controls.

Where is the System.Windows.Forms.Integration namespace?

I can't seem to find it, trying to keyboard input in a wpf form spawned from a winforms form. Found this: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/442782b1-00a1-4e2e-9cc6-ae99b6699126/ But when I try to use it, VS2008 complains about not being able to find the System.Windows.Forms.Integration namespace. I couldn't find a reference in the add references.
The only thing I can think of it maybe because it was a VS2005 project ported to VS2008?
You'll need to add a reference to WindowsFormsIntegration. If you do a Add Reference in Visual Studio, it will be near the last DLL available in the .Net tab
On my machine it's located at
%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll
Visual Studio filters the available namespaces according to the type of project you chose. If you need a namespace that is not listed, click the [Add...] button on the references tab of your project's properties. This will pop-up the Reference Manager window. Choose "Framework" from the list of Assemblies in the left-hand panel. This will display all the Microsoft provided namespaces. You will find WindowsFormsIntegration there.
Just came across the same problem.
While adding a reference to WindowsFormsIntegration.dll didn't work as this has no WF controls in it, I did find that adding a reference to System.Windows.Forms worked perfectly fine.
Use newer:
%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsFormsIntegration.dll

Resources