Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we handle Site.mobile.master and alternative rendering? #91

Open
csharpfritz opened this issue Feb 17, 2020 · 4 comments
Open

How do we handle Site.mobile.master and alternative rendering? #91

csharpfritz opened this issue Feb 17, 2020 · 4 comments
Labels
help wanted Extra attention is needed question Further information is requested
Milestone

Comments

@csharpfritz
Copy link
Contributor

In the later versions of ASP.NET Web Forms, the concept of .mobile.aspx and .mobile.master pages were introduced to allow for alternative rendering of web forms that would target mobile browsers.

How should we handle this feature?

@csharpfritz csharpfritz added help wanted Extra attention is needed question Further information is requested labels Feb 17, 2020
@csharpfritz csharpfritz added this to the Future milestone Feb 17, 2020
@SQL-MisterMagoo
Copy link
Contributor

It is possible to switch default layout, for example if you had a way of detecting mobile (there are lots of ways of course), you could just switch layout in the router

<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData=routeData DefaultLayout=Layout />
    </Found>
    <NotFound>
        <LayoutView Layout=Layout>
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>
@code { 
    Type Layout;
    protected override void OnInitialized()
    {
        if (IsMobileDevice)
        {
            Layout = typeof(MobileLayout);
        } else
        {
            Layout = typeof(MainLayout);
        }
    }
}

Of course there are more complicated scenarios, such as using mobile but allowing the user to switch to desktop mode and back again, but the concept is still the same - just swap the default layout.

@csharpfritz
Copy link
Contributor Author

I think we should provide that IsMobileDevice property to help with this

@SQL-MisterMagoo
Copy link
Contributor

I think that WebForms had some pretty comprehensive ways of detecting this - is any of that code open source / available to this project?

@csharpfritz
Copy link
Contributor Author

csharpfritz commented Feb 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants