Skip to content

MVUX and C# Markup getting fullscreen using a button #18136

Answered by mcNets
emem67 asked this question in Q&A
Discussion options

You must be logged in to vote

@emem67 Try this:

1- Add a Maximize() method to the Application class: (I would move the logic for all TFM here.)

public void MaximizeWindow()
{
    var appWindow = MainWindow?.AppWindow ?? throw new InvalidOperationException("AppWindow is null");

    MainWindow?.DispatcherQueue.TryEnqueue(() =>
    {
        if (appWindow.Presenter is FullScreenPresenter)
        {
            appWindow.SetPresenter(AppWindowPresenterKind.Overlapped);
        }
        else
        {
            appWindow.SetPresenter(AppWindowPresenterKind.FullScreen);
        }
    });
}

2- Change the ViewModel

#if HAS_UNO_SKIA
        var app = Application.Current as App;
        app?.Maximize();

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
7 replies
@emem67
Comment options

@mcNets
Comment options

@emem67
Comment options

@mcNets
Comment options

@emem67
Comment options

Comment options

You must be logged in to vote
5 replies
@emem67
Comment options

@mcNets
Comment options

@MartinZikmund
Comment options

@mcNets
Comment options

@emem67
Comment options

Answer selected by emem67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants