dotnet / dotnet/maui

Make it possible to raise page events (NavigatingFrom, NavigatedFrom, NavigatingTo and NavigatedTo) from page descendants

Open
#4,190 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-architecture area-core-lifecycle area-navigation proposal/open
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

Description

I develop custom controls and need to raise such events in my custom page implementations (like flyouts etc).

Public API Changes

It should be added some methods to Page class to raise Navigated events

public class Page: ... {
    protected void RaiseNavigatedTo(NavigatedToEventArgs args)
    {
        NavigatedTo?.Invoke(this, args);			
    }

    protected void RaiseNavigatingFrom(NavigatingFromEventArgs args)
    {
        NavigatingFrom?.Invoke(this, args);
    }

    protected void SendNavigatedFrom(NavigatedFromEventArgs args)
    {
        NavigatedFrom?.Invoke(this, args);
    }
}
Intended Use-Case

I develop custom controls and need to raise such events.

public class MyCustomContainerPage : Page {
     //.....

      void OnMyContentChanged(Page oldContent, Page newContent) {
         //. .....
         //
         oldContent?.RaiseNavigatedFrom(new NavigatedFromEventArgs(newContent));
 	 newContent?.RaiseNavigatedTo(new NavigatedToEventArgs(oldContent));
      }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Page class and its existing NavigatingFrom, NavigatedFrom, NavigatingTo, and NavigatedTo event declarations. Trace how navigation currently raises them, then determine how protected raiser methods should support custom Page descendants and verify that the intended custom-container scenario can raise the events.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.