Refresh Or Update Page on click of back button (WP7) - windows-phone-7

I have used the standard navigation service in my app but the problem is
Accounts Page (Show info from datacontext) -> Add Accounts Page
now if i give navigation to Accounts Page from Add Accounts Page it creates new instance of Accounts Page as below
Accounts Page (Old Data) -> Add Accounts Page -> Accounts Page (Updated Data)
when i get to the new instance the data on the page shows the new entry but if get back i get to the add accounts page again & then Accounts Page (Old Data) which does not show the updated entryso i have to get back to the home pag & again navigate to Accounts Page to get it updated so what should i do to make Add Accounts Page save button send me back to the Accounts Page & its updated?
I tried with
NavigationService.GoBack();
NavigationService.RemoveBackEntry();
NavigationService.Navigate(new Uri(string.Format("/Accounts.xaml?Refresh=true"), UriKind.Relative));
but nothing worked as i wanted PLEASE HELP

NavigationService.GoBack(); is the right way. The problem you need to focus on is: "how to refresh the data when going back to the Accounts Page". The solution depends on your application's architecture. If you used the MVVM pattern, then it's just a matter of adding the new account to the data source in the viewmodel. Otherwise, you should probably reload the account list in the OnNavigatedTo method of your page:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Load the accounts
}

Related

White Screen Issue while navigating in Xamarin forms Prism MasterDetails Page

I have implemented MasterDetail Page using xamarin forms prism and I have following Pages in my app.
1) Master
2) Home
3) Employee
4) Profile
-- Initially App is set to Master - Home (Detail Page) page after login. From Home page i navigate to Employee (Detail Page) using code as follows :
await _navigationService.NavigateAsync("NavigationPage/Employee");
-- From Employee Page I navigate to Profile (Content Page - Non Detail page) by clicking on one of the employees using code:
await _navigationService.NavigateAsync("Profile", lstparam, null, false);
-- Once home button is clicked in profile page, i want to navigate to Master - Home (Detail Page) . However it navigates to Employee (Detail Page) .
await _navigationService.GoBackToRootAsync();
Checked navigation stack by debugging , It was only showing Employee (Detail Page) Page in it. Also tried navigation to home page by using following code :
await NavigationService.NavigateAsync("/Master/NavigationPage/Home");
The above code is working and i can navigate to Home (Detail Page) , but I am getting White Screen while navigating to Profile to Home Page .
Attached Screenshots . Please Help .Thanks in Advance.
MasterPage
Details_Home
Details_Employee
Profile
Whitescreen
I recently had a very similar problem but it did not depend on prism.
I wanted to create an autologin features by bypassing the login (ContentPage) and calling the homepage (Master And Detail Page).
To do this I had to call the async login service method in my application class.
in order:
Call async service
Call NavigationService.NavigateAsync
In this case appears a blank page
To Solve:
Call NavigationService.NavigateAsync
Call async service
In my case, it happened to me for being using the wrong NavigationService.
I had a static Navigator class that I've been using it for managing and Logging navigations in the App (a simple wrapper), which has a property called Instance, of type NavigationService that I was setting it to the NavigationService of the App.xaml.cs
Reassigning it on each ViewModel (in the ViewModelBase's constructor) fixed the white page bug for me.
Hope it helps someone!

How add a back button manually in NavigationPage?

I have a login page in Xamarin.Forms without NavigationPage, but I have a button in this page to navigate to other page to create a new user and, in the page of insert user, I need add a back button to allow users go back to the login page.
How can I do that?
ps: I'm using Prism framework.
My code to open login page:
await NavigationService.NavigateAsync("Login", parametrosNavegacao);
My code to navigate to page that register user:
await NavigationService.NavigateAsync("NavigationPage/CadastroUsuario", useModalNavigation: true);
NavigationService.PopupGoBackAsync();
https://github.com/dansiegel/Prism.Plugin.Popups
One option can be
NavigationService.NavigateAsync("/Login");
the / bebore Login means Absolute url, and prism clears navigation stack, other wise clicking android's back button will again open up insert user page.

Master Detail Page Xamarin Forms

Aright, let me try to make it a bit simple,
When i Login: i set the my root page as a Normal ContentPage,
var firstPage = new BaseNavigationPage(new DashBoardPage());
(DashBoardPage is just a contentPage, with few buttons)
On click of the buttons, i navigate my app, using
NavigationService.NavigateTo(ViewModelLocator.CommentPage);
Now on DashbOard, there is button, which redirects me to a Page which is a MasterDetailPage, so using some custom thing,
i navigate by setting my MasterPage,
NavigationService.SetMainPage(ViewModelLocator.MASTER_PAGE);
Following is my MasterDeatilPAge Code;
var menuPage = new MenuListPage();
Master = menuPage;
Detail = new CustomNavigationPage(new WorkTaskPage());
Now , on the Menu Page, i have an List Item as DashBoard, and i have to redirect my App to the first Page,
So how can i do that, since with MasterDetail Page, i can either Navigate Detail Page or Set the Detail Page,
So how can i redirect it to the Dashboard Page, and i want all navigation to work normally when i am on dashboard page, without changing any navigations.
Hope this is a bit clear?

how to know the base page user is navigated from to a new page in windows phone

In my windows phone application I want to know from which page user is navigated to a new page.I want to get the name of the from page from which user navigated to this new page ?
Any property which gives us this ?
You can use NavigationService.BackStack to traverse the current Navigation Stack and figure out where you came from: http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationservice.backstack(v=vs.92).aspx

About Joomla Registration Form

I'm using Joomla template... and I want to to register new user in it, but the problem is that whenever I create a new account and input all the fields and click on submit button the whole form is reset and no registration take place so help me out of this problem...
Check if new user registration is enabled in back-end settings. To do that - go to admin control panel, select Site > Global Configuration > System and check Allow User Registration parameter.

Resources