The type 'StackPanel' was not found in Visual Studio for Mac

548 views Asked by At

Photos of the code: The error: ContentPage

Cs file

Xaml file

another css file

I am new to Visual Studio for Mac(building my first project here). So far everything was going just fine, but when I tried to utilise <StackPanel> </StackPanel> - I ran into a problem. The is underlined with red, and I received an error that < The type 'StackPanel' was not found.Verify that you are not missing an assembly reference and that all referenced assemblies have been built.>

Additional information: File's form: File.xaml

Could you please indicate which assembly or package should I install to eliminate the error? And also specify the way to execute your instructions.

1

There are 1 answers

8
Raptor22 On BEST ANSWER

StackPanel could not be found (missing assembly reference)

Not entirely sure but you can try to add the PresentationFramework reference in your project references

Open project references

Add PresentationFramework

If that doesn't help read this post and it's comment: The type was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built

Try adding the reference in your code with something like this

<Window x:Class="YourClassName"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="StackPanel" Height="160" Width="300">

Some links:

https://www.infragistics.com/help/wpf/adding-assembly-to-a-visual-studio-project

https://wpf-tutorial.com/panels/stackpanel/

https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml?view=netframeworkdesktop-4.8

Hope these can help explain a bit more