WPF avalon wizard missing wizard control after adding System.xmal - wpf

I tried Avalong Wizard control for WPF and have the following issue could you guys help me spot the problem.
Added Avalon reference as per the tutorial and made some changes to the xmal for the window
and the wizrd appears. using the control or right options I can change the page, add or remove a page.
I added few pages and controls for each.
Then when I tried to rebuild the project I got the following messages
Errors
Error 1
The type 'System.Windows.Markup.IQueryAmbient' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. D:\SkyDrive\Dev Zone\Ms.NET\Projects\SDF_Export\SDF_Export\Window1.xaml.cs
Error2
The type name 'IComponentConnector' could not be found in the namespace 'System.Windows.Markup'. This type has been forwarded to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. D:\SkyDrive\Dev Zone\Ms.NET\Projects\SDF_Export\SDF_Export\obj\Debug\Window1.g.cs
Then added the reference System.Xaml - Rebuild sucessfully
Tested the project everything works fine in the application where I am able to switch pages
Issue
When I come back to do more changes to the project wizard control is missing.
Now I cannot change, add, remove page using the wizrd control or the right click options.
I have attached the project here with.
Project Files

Related

Including UWP project in WPF project raises runtime errors

Project I work on need to show UWP control from UWP library inside of WPF window.
Here is the document page on which I had based my work (check section for adding custom UWP control):
https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/windowsxamlhost#add-a-custom-uwp-control
Had setup WPF window and it shows standard UWP controls (like button) at the runtime just fine. However, when I include UWP project, WPF window throws exception at start (at the moment of context initialization of EF).
Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Sqlite version I'm using is 1.0.88.0 and EF is 5. But it doesn't make any sense that it clashes with these libraries?
Ffixed an issue on startup by updating SQLite package to 1.0.111.0 and EF to version 6.2.0.
Including UWP project in WPF project raises runtime errors
Derive from official document, I create sample project. When build the project, it throw many errors that lost assembly. After add the Windows.winmd file every thing work well. You could try to add the Windows.winmd file where in the C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd to WPF app reference.
Detail steps
Right click project References -> Add References -> Browse(file type all file)-> select Windows.winmd
And this sample project that you could refer this.

Form designer has became unavailable for a form in Visual Studio

After some work on form in Visual Studio 2015, form designer suddenly became unavailable.
Symptoms:
item View Designer is missing from context menu of form code class in Solution Explorer
usual keyboard shortcut cannot be used to switch to the designer
.Designer and .resx files are still in place and correctly shown as subtree items of form code class
.Designer and .resx files look healthy from inside, they have every mandatory part
Visual Studio reports 0 errors
only one form is affected, other can be open in the designer normally
Why the Visual Studio is not evaluating form files as valid, not showing Designer view?
I accidentally locked myself out, with error message written behind the locked door.
Issue: During the work, I temporarily added a trivial helper class to the beginning of the form code file. If I had the designer open that time, I could have seen the following error:
The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.
The catch is, the error shows only in the designer. If you have only code window open at the moment, you won't spot the error – and worse, you are no more allowed to enter the designer view to discover it.
So a case can happen, when Visual Studio gives no clue – the only help is qualified guess and trial.
in case anyone else needs a different fix, i had the same issue but it was with telerik reports.
not sure why or how, but my issue was a corrupted project file. The subtype element was missing for the reports. This element tells visual studio to use a designer template to open the file, instead of code view.
the subtype depends on what type of control it is. For a windows form the subtype would be Form
unload the project -> right click -> edit ".csproj"
so i changed this (in the project file):
<Compile Include="Report1.cs" />
<Compile Include="Report1.Designer.cs">
<DependentUpon>Report1.cs</DependentUpon>
</Compile>
to this:
<Compile Include="Report1.cs">
<SubType>Component</SubType> <!-- if winform, this would be Form instead -->
</Compile>
<Compile Include="Report1.Designer.cs">
<DependentUpon>Report1.cs</DependentUpon>
</Compile>
reload the project.
Just add existing designer of the form from the directory to solve the problem.
After adding the existing file in visual studio the context menu for 'view designer' is showing.

UserControl in same project

I have a simple WPF Control project with 1 window and 1 custom user control. I built the project and the control showed up on the toolbox - great. I dragged a couple instances of the control onto the window and it worked as expected - great again. It added an xmlns for 'my' that referenced it's own base namespace and put in the proper references for the controls - perfect.
Then I tried to build it, not so perfect. It appears that it is looking for it's own build dll so when it starts to build the project and deletes the dll then suddenly it can't find the namespace reference so the build fails. Then the dll is missing so the designer gives the error. I can delete the reference to this namespace which fixes the error and I can rebuild successfully, which returns the dll which means I can paste the reference back in with no errors... until I try to build again...
Is there any way to do this without making every control it's own dll?
Don't do a rebuild on release?
Designer errors don't stop my compiles. But the designer error doesn't go away until release is built.
Check your build settings.

Silverlight Designer not finding custom controls

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

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.

Resources