I have some pages in the win8 application, most of which have a similar layout, I use Frame.Navigate to switch the pages. Just wonder if there is something like MasterPage in asp.net webform/mvc.
Just create a page with the layout you want and then use templates to customize it for particular views. You could have one main view .xaml file and then create a resource dictionary file (for separation purposes) for each different way you use it.
Edit:
I found someone who made a "Master Page" for wpf. See here. You could do something similar for metro.
Related
I have application based on Shell. Application contains pages with tabs which are deffined in Shell. Everything works properly and correctly.
I need create second level page with tabs whitch contains options for return to previous page. In the case of standard "ContentPage", "Routing.RegisterRoute" and "Shell.Current.GoToAsync" it is no problem. However, if I create a TabbedPage like this, my application ends with exception:
0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception
I am aware of this information:
TabbedPage is incompatible with .NET MAUI Shell apps, and an exception will be thrown if you attempt to use TabbedPage in a Shell app.
However, I am not sure if this also applies to the second level page, or only to pages that are directly referenced in Shell.
How can I create second level page with tabs?
Is there anyone who has encountered a similar problem, or someone who can give me advice?
Thanks a lot
Using shell, you are limited to content pages.
Navigating to such page is not a problem. Calling GoToAsync will give you the "second layer" you request.
The more interesting part is how to implement tab control, so you have tabs in that ContentPage.
One way to solve this is by using BindableLayouts.
(Here is a good example: https://dev.to/davidortinau/making-a-tabbar-or-segmentedcontrol-in-net-maui-54ha)
You can make really neat UI with this.
It will be worth your time.
Ask if you have any questions.
You can combine TabbedPage, FlyoutPage and NavigationPage instead of shell if you really want to create second level page with tabs. Obviously shell is based on flyouts and tabs, so if you use FlyoutPage and TabbedPage alone in your project, it will be more flexible and troublesome than the shell.
These are the documents about the specific use of FlyoutPage and TabbedPage, you can refer to them if you need: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/flyoutpage?view=net-maui-7.0 and https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/navigationpage?view=net-maui-7.0.
Hope this will help you.
How can I have a fixed footer like Instagram through multiple pages in a xamarin forms app without determining it on every page?
I find out I can use a nuget package to make this like a tapped page but it makes me write all the codes in one page like this:
https://www.youtube.com/watch?v=Cp_2F621Az0
how can I implement this more efficiently
In this cenario I suggest you use Tabbed Page. Because the tabs will are part down in your app.
In this link you can read and understand how works a tabbed page:
https://developer.xamarin.com/samples/xamarin-forms/Navigation/TabbedPageWithNavigationPage/
As development of an ASP.NET Web Forms project rolls on, the code used in markup sometimes becomes repetitive.
Are master pages my only option to reuse that markup? Sometimes my Master page content won't refresh. Maybe it's time to replace it with something similar if it exists.
Yes, use a UserControl but that would be wired alternative cause in that case you will have to create separate usercontrol for header/footer/menu item ... etc and have them registered on each page separately using a #Register page directive.
I've been working on a project and I noticed I reuse the same menu over and over again and it got to a point where, if I needed to change something I would need to change 20+ pages too because of it being a menu.
My question is, is it possible to have a single aspx file with the working menu on it, and have the other pages call it? So far I've tried
<?php include('Menu.aspx') ?>
<iframe id="myIframe" src="Menu.aspx" height="100%" width="100%"></iframe>
The later (iframe) showed something but I was unable to resize it and the links didn't work either. The php one didn't show anything. Any help would be appreciated, thank you very much.
You can use the following approaches to solve this:
Master Pages allow to have a common layout that is applied to several aspx pages. The master page defines a layout and provides some content placeholders that are filled in by the pages that reference the master page. Your example of a menu fits good; the menu would be placed on the master page. See this link for details.
Another way to share layouts are ASP.NET UserControls. These are created as ascx files and can be reused in several aspx pages. See this link for details.
The best option for you is to create an User Control, and use it in all your pages.
An user control is similar to a server control (e.g. asp textbox, update panel etc.), but custom made by the developer to suit his specific needs.
If the menu is more like the common layout/theme of all your pages you can use a Master Page instead.
You have to make yourself familiar with master pages. See this as a beginner tutorial: http://www.codeproject.com/Articles/333650/Beginner-s-Tutorial-on-Master-Pages-in-ASP-NET
There are two option to reuse menu in asp.net page.
Master Page
User Control
using sitemap and add into master page.
https://msdn.microsoft.com/en-us/library/aa581781.aspx
http://webproject.scottgu.com/CSharp/MasterPages/MasterPages.aspx
Hope this will help you.
thanks
I have an ASP.NET web application that I am making and I am thinking of making it a tabbed interface using Telerik's RadTabStrip. I am trying to figure out the best way to approach this though. I would need about 10 tabs because I have about 10 different main areas of my application. My question is how is the best way to integrate the content into the tabs. All of the simple examples I've seen create RadViews with imbedded HTML/ASP.NET content. The problem with this approach is that, with 10 tabs, it would make my main ASPX file really really big and it would be kind of clumsy to work with, having to integrate all 10 pages into one page. Is there a better or more accepted way to accomplish this?
I think, you have several possibilities:
Use one RadTabStrip and several RadView controls. Put the content for each tab into a separate user control (*.ascx). Then you only have to include the user controls in your main aspx page.
Use a master page and put the RadTabStrip on it. Create a separate page for each area of your application (each using the same master page). Use the RadTab's NavigateUrl property to navigate to the corresponding page (as shown in this demo).
there are certainly other possibilities...