Navigation framework in silverlight - silverlight-4.0

In silverlight navigation framework how to navigate to a xaml page from mainpage.xaml ? In my scenario i have menu items and need to go to corresponding menu item's xaml page on menu click.

You can register a NavigationService variable on startup in your App.xaml.cs file. Assign the variable the first time you visit the page hosting the navigationframe - you get the NavigationService from the frame control.
In you menu usercontrol you can access the NavigationService in the App namespace:
((MyApp)App).NavigationService

Solution :-
In xaml pages which are of type usercontrols the navigation can be carried out by adding navigation frames in xaml page.
Ex:-
Xaml Page
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}"
Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
<navigation:Frame.UriMapper>
<uriMapper:UriMapper>
<uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
<uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</uriMapper:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
In .cs page
ContentFrame.Navigate(new Uri("URIPATH", UriKind.Relative));
// where URIPATH is the class to which the navigation is required

Related

Navigation Bar is not transforming in RTL mode xamarin forms

I was using a masterdetailpage in my app which was working fine in RTL mode once i added
FlowDirection="{x:Static Device.FlowDirection}"
and i set flow direction dynamically in App.cs
but i have to change it to flyoutpage which is working well in RTL but the navigation bar is not transferring to RTL.
hamburger icon is fine
I've a problem with the navigation bar
//Start of the app in App.cs
MainPage = new NavigationPage(new Login() );
//After Successful Login
Application.Current.MainPage.Navigation.PushAsync(new FlyoutMainPage());
// in FlyoutMainPage()
NavigationPage.SetHasNavigationBar(this, false);
There are some limitations about RTL localization in xamarin forms. You could refer to Right-To-Left localizations limitations.
NavigationPage button location, toolbar item location, and transition animation is controlled by the device locale, rather than the FlowDirection property.
That means you could change the language and region to make it.
And then you have to tell your application that it’s allowed to recognize a right-to-left layout. For iOS, add the right-to-left language in the CFBundleLocalizations section of your Info.plist. Such like the following:
<key>CFBundleDevelopmentRegion</key>
<string>ar</string>
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
</array>
For Android, you could add android:supportsRtl="true" to your application tag in your AndroidManifest.xml
For more info, you could refer to Right-To-Left Localization in Xamarin.Forms
Hope it works for you.

How to render a bootstrap modal in a container different than body

is it possible to specify a container for a modal dialog different than body, so the component and the backdrop gets rendered inside this new container.
I have not found something like this in the documentation.

How to load a component without a page reload on ion-button click?

I have a button on the homepage of my application:
<ion-button href="/start" class="btn" color="danger">start</ion-button>
However, I noticed it actually reloads the page when clicked.
I also have ionic tabs (https://ionicframework.com/docs/api/tabs), and when a tab is clicked a component is loaded instantly.
How can I achieve the same functionality for ion-button?
The tab component has an integration with the router, which allows the tab to function as a vue-router link. ion-button doesn't seem to have the same integration. The documentation for the href prop states:
Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
Using href makes the button function as a regular browser link which will cause the page to reload. Instead, you can wrap the ion-button in a router-link tag or call $router.push in the button's click event.

RNRF: How open drawer with custom "hamburger?" Not documented in API. Error: "Actions.get" is not a function

I'm using the
<Drawer>
tag and it works great, but I don't want the default screen layout with the default "hamburger" menu icon at the top-left of the screen.
I've spent hours trying to get my own button to open the drawer.
I've done my research homework:
The RNRF API for Drawer doesn't list open/close methods:
Was happy to find two EXACT issues "How to open Drawer When use a custom icon in Scene" #1101 and "How to customize drawer button" #1078 on GitHub but none of the solutions work--so close but yet so far!
In Button component:
onPress={() => {Actions.get('drawer').ref.toggle()}}
but get this error:
Here is my main code:

How to switch Xamarin forms Main Page from Master Details Page to Content Page?

I am working on an Xamarin forms Application. In which on App.cs I check
CrossSecureStorage.Current.HasKey("SessionToken")
then navigate to HomePage() which is a Masterdetailspage and if no security token then I navigate to LoginPage() which is a ContentPage like this
if (CrossSecureStorage.Current.HasKey("SessionToken"))
MainPage = new NavigationPage(new HomePage(true));
else
MainPage = new NavigationPage(new LoginPage(this));
then when user clicked login button I set main page to HomePage() like this
MainPage = new NavigationPage(new HomePage(true));
and when user clicked logout button I set main page to login again like this
CrossSecureStorage.Current.DeleteKey("SessionToken");
MainPage = new NavigationPage(new LoginPage(this));
It works fine when user is already logged out. Login and logout both works fine. But if user was already logged in says
CrossSecureStorage.Current.HasKey("SessionToken")
has value then on logout button press app crashes and got this Exception
System.ArgumentException: Handle must be valid.Parameter name: instance
I figure out that if in App.cs I changed HomePage from MasterDetailsPage to a new ContentPage then on button press change MainPage to HomePage then it works fine but I want to directly show homepage to user. (Means if first page assigned to MainPage is a ContentPage then app works fine but if first page is a MasterDetailsPage then app crashes on reassigning MainPage to any Page.)
Please help.
Thanks in Advance.