'PlatformEffect' does not exist in the namespace 'Microsoft.Maui.Controls.Compatibility.Platform.UWP'

Vince L 41 Reputation points
2022-08-17T18:26:12.363+00:00

I am trying to follow along the instructions for migrating Xamarin.Forms Effects to .NET MAUI on this wiki page: https://github.com/dotnet/maui/wiki/Migrating-Xamarin.Forms-Effects

In the section Effects in .NET MAUI, there are platform dependent code blocks. No matter what context is selected, the corresponding platform does not have 'PlatformEffect' existing.

So when I have the context be Windows, the line:

public class FocusPlatformEffect : Microsoft.Maui.Controls.Compatibility.Platform.UWP.PlatformEffect has red squiggles under the "PlatformEffect" at the end of the line and the error says:

The type or namespace name 'PlatformEffect' does not exist in the namespace 'Microsoft.Maui.Controls.Compatibility.Platform.UWP'

Has the location of PlatformEffect changed or, if not, what am I doing wrong?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,579 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rob Caplan - MSFT 5,537 Reputation points Microsoft Employee
    2022-08-19T20:27:11.177+00:00

    This is expected. That type does is not needed and was removed.

    To create a PlatformEffect inherit from Microsoft.Maui.Controls.PlatformEffect.

    There is a full example of a FocusPlatformEffect in the MAUI Controls Sample

    The wiki page you quoted is out of date and not official documentation. The wiki is designed for devs working on the Maui project - while it's often useful for general development, they may not always apply or be up to date. In particular, consider anything mentioning UWP suspicious as MAUI does not target UWP. For Windows, MAUI targets WinUI3.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.