Can't find the Prism.Navigation.TabbedPages namespace - c#

I'm building a xamarin.forms mobile application with Prism, and want to use INavigationService.SelectTabAsync method. This method, according to the Prism documentation, should be in the Prism.Navigation.TabbedPages namespace but Visual Studio tells me that that no such namespace exists.
I have found absolutely none with a similar issue and when I search for the method name in google I get a measly 7 results back.
I have also tried making a completely new xamarin.forms app through the Prism template pack and still nothing shows up. I even tried installing all the prism Nuget packages and messing around with adding references to the project, but nothing...
This is what the Prism docs tells me to do:
Selecting a Tab
You can select a tab programmatically from within a tab's ViewModel by using >the INavigationService.SelectTabAsync method. In order to use this method, >you must add the Prism.Navigation.TabbedPages namespace to your ViewModel.
using Prism.Navigation.TabbedPages;
async void SelectTab(object parameters)
{
var result = await _navigationService.SelectTabAsync("Tab3");
}
And this seems easy enough but when no "TabbedPages" shows up in Intellisense for me (only the Xaml one) in the Prism.Navigation namespace I'm stuck.
Version details:
Visual studio 2019 16.0.1 Preview 1.0
Visual studio 2017 15.9.5

Try ver7.2.0.1175-ci in myget org.
Add "https://www.myget.org/F/prism/api/v3/index.json" to package source and check "include prerelease".

Please, try to add the TabbedPage using the Prism Template as shown in the attached image. In addition to that, this Video by Brian Lagunas somewhere around 1:06:00 could help.

Related

Migrate Xamarin Forms Effect to .NET MAUI

For a Xamarin Forms application, I have been using a solution to track touch using code from an example out of Microsoft's Xamarin Forms Sample Project, specifically the Touch Tracking Effect sample.
I took that sample and simplified it down to just directly starting up with the BoxViewDraggingPage.xaml from App.xaml.cs and removing all other XAML files. That compiled and ran fine.
I then created a .NET Maui App with the same BoxViewDraggingPage (and the same TouchActionEventArgs.cs, TouchActionEventHandler.cs, TouchActionType.cs, and TouchEffect.cs) as was in the Xamarin Forms version.
I added the same TouchEffect.cs files that were in the sample for the specific platforms (iOS also has a TouchRecognizer.cs file)
When running it at that point I got the following:
So then I tried following the instructions for Migrating Xamarin.Forms Effects. The explanation for how Xamarin.Forms effects were set up matched perfectly, but it was unclear to me from that page what class the section titled "Effects in .NET MAUI" was replacing since it had a different class name than the previous code snippets earlier in the article. It seemed like it is replacing the FocusEvent class in the shared platform code and then specifies the platform specific code within #if platform sections (#if WINDOWS, #if __ ANDROID __, etc.) and so I am guessing that means the TouchEffect.cs files are no longer needed in the platform specific folders.
I didn't have a chance to find out if that was the case or if it works, because when I try to compile, I get:
I don't find any missing Nuget packages or assemblies when I tried searching. If I click the dot after Platform, I get the following choices, with instructions to use the navigation bar to switch contexts:
But I am already targeting net6.0-windows10.0.19041.0:
so I'm not sure why it says Not Available for that.
So, I am stuck trying to get this to work.
I am looking either for a solution to get the sample code working as it is in the Xamarin.Forms project, but for .NET MAUI (whether that be set up how the sample originally had it or how it is described in the Migrating Xamarin.Forms Effects link) - it could be that I am missing something simple in how to get that Microsoft.Maui.Controls.Compatibility.Platform.UWP piece to compile.
Or, the other possibility is that same link says that .NET MAUI Handlers can also handle this type of scenario. So if someone can show all the pieces that would need to be modified in order to do the same solution but using .NET MAUI Handlers, I am open to that. But it seems that the easiest path, though, should be to get the Effects working in .NET MAUI since everything is already written that way. I am just leaving both options open in looking for a solution.
EDIT:
OK, I figured out why the UWP portion had red squiggles under it. I figured out what "using the navigation bar to switch contexts" in the above screenshot meant. It meant I needed to select the context in the dropdown pictured below:
However, this just moves the squiggles to PlatformEffect and I cannot figure out what to do with the context or anything else to resolve that:
OK, I found out that PlatformEffect now inherits from Microsoft.Maui.Controls.PlatformEffect instead of the separate Platform inheritances shown in the Migrating Xamarin.Forms Effects example. That example is out of date and I didn't realize that and so it was confusing me.

Add reference not showing in vs 2019 on mac

It is my first time using visual studio 2019. So, I wanted to use the Clipboard class. In order to use the clipboard class, it looks like I have to add a reference, then import using System.Windows.Forms. However, when I right-click on the solution area, then press add reference, it just gives me an empty page.
So, I searched up the problem and people fixed the problem by enabling codelens. However, I found that there were no codelens for mac.
How can I fix the problem with the add reference?
Also, I wanted to know how to import the Clipboard class or if I was doing it right?
Windows Forms is not supported on macOS, so you won't be able to use that class.
Either you use Xamarin.Essentials or use the native NSPasteboard.

There are no scaffolders supported for this item Visual Studio 2019

I'm using Visual Studio 2019 version 16.0.4, and I tried to create a view or a partial one on asp.net core 2.1 (in views folder) but I get an error
There are no scaffolders supported for this item
Then I realized this problem happens when you have a folder which its name is "Pages" in your project that we use this folder for razor pages .
If I remove the pages folder then the views scaffold works. When I put it back it is broken again.
I don't know it is a bug or not but I need to use both pages and views together on my project...
Update 31/7/2019
I was mistaken (24th Update), see comments on this post, it's apparently still broken, either way, the original answer below still works, in both cases.
Update 24/7/2019
The answer below still stands if your using an older release of Visual Studio 2019, however please be aware this has now been fixed in the more up-to date releases:
https://developercommunity.visualstudio.com/content/problem/562039/there-are-no-scaffolders-supported-for-this-item-1.html
Original Answer
There's currently a known bug in Visual Studio 2019 for this scenario.
There is some semi official advice on the GitHub issue tracker, but it doesn't always work.
MS Will fix it eventually, there appears to currently be no timescale.
For now however, if you right click and use add new item:
Then pick the item type you want (In my case it's a razor page)
Then you'll find everything still works as expected. The bug only seems to affect the shortcut menus.
I see this problem in my visual studio when I add "Pages" Folder to my ASP.NET MVC core project.
before I adding this folder, scaffolding works fine, and when I add this, I see the error.
Also when I remove "Pages" folder, scaffolding work fine again.
;)
I solved it by downgrade Microsoft.VisualStudio.Web.CodeGeneration.Design on version 2.2.4 from 3.x. from Nuget packages for my solution.
I hope it helps some one.
I Created a folder named Views and Error never shows again
None of the above fixed my issue, so I thought I'd leave feedback as well. Updating .NET versions fixes this for me. I was on 4.5 and moved up to 4.5.2. To test this, I created a sibling project of the same type (.NET MVC Web) with 4.5.2, and tried to create scaffolding items again, and it works.
I will either use the new project to house my scaffolding items, or try to upgrade my original project to 4.5.2. I'm sure any version over 4.5.2 would work as well, but I'm using an older one due to server architecture.
UPDATE: It would appear that updating the version is not what solved the issue. So it was the act of adding a new project that works... I'm not sure why though. I will update this again if I find out.
I checked it couple weeks ago and it seems solved by the updates i guess.
I don't know if it is my same problem but its very similar...
My solution was update NuGet.Frameworks
*My problem:
For example, I created a method called AnyName, next I did double click and add new View
Image1
So, next I simply did click in add new Razor View
Image2
Next start the Scaffolding to create the new View:
Image3
But it cant create the view and send the follow error:
there was an error running the selected code generator package restore failed
(there was an error running the selected code generator package restore failed)
Im Using:
VSCommunity 2019 v16.7.2*
Getting this error on VS Community 2022 v17.0.2
Project ASP.NET Core Web App MVC (6.0)
When using option add Controller.
error
Works fine when using add new item and then choosing the specific file.
This is a really rare situation but If you accidentally created an F# project instead of C#, that will cause the issue. It will somehow append to the C# solution for some reason, excluding it and creating new C# app with Microsoft.VisualStudio.Web.CodeGeneration.Design version 3.1.5 (net5.0) will fix the issue.

Grid is not supported in a Windows Presentation Foundation (WPF) project

I am learning how to create a Class Library (Windows Store apps) and used a UserControl template to add a user control to it.
Then I added a Grid tag to accompanying XAML. However, the tag is underlined with blue squiggles and when I hover over the tag there is
Grid is not supported in a Windows Presentation Foundation (WPF) project
tooltip shows up.
The library seems to build without errors. I've added the library to an application and use the control in its code. The application is also builds just fine. However, when I run the application I get XamlParseException exception.
I am using Visual Studio 2012 RTM. Both the library and the application reference only two standard assemblies (.NET for Windows Store apps and Windows).
What I might done wrong and how should I fix the library?
In my case I switched from Debug to Release, and then back, and the error was gone.
Go to "Build > Configuration Manager..." and Make a new platform for x86 for all your projects.
It doesn't have to be the active one, you can leave that as Any CPU.
Hope it works as for mine...
I've recently had the same error and found the following in the output window:
10>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFX.targets(268,9): error MC6000: Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore, PresentationFramework' in the reference list.
The solution for me was to add the missing references to my project.
For me it helped to set the "Target framework" in application-properties to .NET 4.0
This appears to be a bit of a "catch-all" for a number of XAML resource errors. I've found two causes so far:
Declaring a Resource outside of the appropriate context- e.g. directly in a UserControl tags, not UserControl.Resources.
Forgetting to include the correct namespace for the "unsupported" class. Example in a basic ResourceDictionary, with no sys namespace defined:
<ResourceDictionary>
<sys:string>I'm not supported</sys:string>
</ResourceDictionary>
I was able to solve my similar issue of..
UserControl is not supported in a Windows Presentation Foundation (WPF) project
.. by removing the PresentationFramework reference and re-adding it via nuget.
[Reposting comment as answer]
I was able to complete the steps with no issues, and it appears you were able to as well. Perhaps there was some other inadvertent modification/setting that was made?
This is xaml getting itself confused. I have the error on one project and not on another. Have a look at the top of the xaml before the grid error and see if there are any references to other controls. Try making a modification that will cause and error and rebuilding one of those controls. Then put it back the way it was to get a succesful build and see if this makes the grid error go away. (it did for me)
Much Like Felix D.s answer, I found from the .csproj file a reference was removed.
Obviously replace the 3 with your needed framework, or use the project properties to set the version ( i think that adds this reference )
Evil Dog Pie was step 1 for me, as some other issues came up. There is always a heap of information in the output log
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
This problem is due to the low version of .NET that you have chosen in your project.
To solve the problem, select the Project from the up menu and then select your Project Properties and from the part of Target Framework select higher version of .NET Framework!
I hope your problem is solved.
Yours sincerely

Expression blend convert example from Silverlight into WPF

Hey! I was looking at a cool layout example in particular the V3FluidLayout.xaml found inside this set of examples : http://gallery.expression.microsoft.com/en-us/DynamicLayoutTrans
Anyhow - this appears to be a silverlight app - it runs within a browser. I am trying to pull the V3FluidLayout example into a WPF app - and struggling.
I "add an existing item" pulling the .xaml file into my project. When it goes to compile it, the following errors are found :
Are these artifacts Silverlight? The following is the xaml code within the V3FluidLayout.xaml file
http://pastebin.com/h9ujUax6
Can anybody help me pin why this is not working - and how I can convert that xaml code to work inside my wpf app.
Thanks
Andy
Basically (and from only a quick glance), you'll need a reference to the WPF versions of System.Windows.Interactivity and Microsoft.Expression.Interactions - they are part of Blend. Actually look at the references of that project and find the exact same references, only for WPF.
It looks like they contain pretty much the same classes for both WPF and Silverlight, so I think it should work in the end.
Add references to the interactivity assemblies found here:
C:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries
You need to install the Blend SDK to get them, the come with Blend also.

Categories