Prism for Xamarin.Forms - Passing Navigation Parameters

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 46

  • @kasozivincent8685
    @kasozivincent8685 3 роки тому +2

    Thanks a lot Brian. This has saved my evening.

  • @Styx1x
    @Styx1x 5 років тому +1

    another great video. Easy to understand and excellent examples

  • @ШураШу-г1о
    @ШураШу-г1о 5 років тому +1

    Great Job! Well Done! Vozmi s polki pirojok!

  • @g00dvibes47
    @g00dvibes47 5 років тому

    Brian, thank you for these videos, they are a Godsend; I inherited a project at my current company that uses Xamarin with Prism and it is super unfamiliar yet made straightforward with these videos. Having some issues wrapping my head around some things in this unfamiliar environment, but maybe I can send you a ping for video ideas? Would be a huge help! Thanks again

    • @BrianLagunas
      @BrianLagunas  5 років тому +1

      Right now, the plan is to cover all the basic topics then move into topic requests. Patron topic requests will have priority, so I recommend becoming a patron so your suggestions is one of the first to be covered. www.patreon.com/prismlibrary

  • @muhammadwaqasaziz4054
    @muhammadwaqasaziz4054 4 роки тому

    Awesome, Awesome, Awesome, Awesome, Awesome JOB MAN!

  • @amanuppal2209
    @amanuppal2209 3 роки тому +1

    Thank you very much for this vedio!

  • @namanvohra8262
    @namanvohra8262 3 роки тому

    A really nice video. However, I am confused as to why the OnNavigatedTo in another ViewModel is not triggered. I have already added the breakpoint as well. The rest of the code is working fine (for instance, data binding).

    • @BrianLagunas
      @BrianLagunas  3 роки тому

      Hard to say. Usually this indicates an error in code somewhere. Possibly you still have a throw NotImplementedException in another method somewhere

    • @namanvohra8262
      @namanvohra8262 3 роки тому +1

      @@BrianLagunas Thanks for the reply. Yes, I solved it yesterday. Indeed it was due to the throw new NotImplementedException. I didnt delete that earlier.

  • @fadelmahmoud9964
    @fadelmahmoud9964 3 роки тому

    Thanks for the video.
    Can someone help me with this issue:
    OnNavigatedTo( ) is executed once the page is added to stack, so when I navigate pages forward then PopBack to the original page, all binding data are not shown in the page bcs the ViewModel does not execute OnNavigatedTo() function as the page already in the stack. So how to keep the data shown in the page OR how to pass parameters directly to ViewModel constructor ?

    • @BrianLagunas
      @BrianLagunas  3 роки тому

      When going back in the nav stack the pages do not loose their binding context. OnNavigatedTo gets called both on a forward nav and a back nav. You must have code in your OnNavigatedTo method that is changing state but not considering a back nav operation.

  • @Nk54fr
    @Nk54fr 5 років тому

    Hello Brian, thanks for the video. Do you know why if I create myself a NavigationParameters with the key "__NavigationMode" to set the navigationMode to New myself because I handle the navigation from MasterDetailPage. I need the __NavigationMode to make the call to OnNavigationFrom and OnNavigatedTo from the MasterDetailPage otherwise, I can't have the Initialize/OnNavigatedTo/OnNavigatedFrom methods working. I need this because I have some pages you can use from the MasterDetailPage or from the HomePage (the default page on the MasterDetailPage. It's just a gridView with some tiles of my favorite pages. They trigger a navService.NavigateTo whereas the Master section set a new DetailPage with a NavigationPage and the desired page. I hope I made myself clear. Anyway, thanks again for this awesome framework !

    • @Nk54fr
      @Nk54fr 5 років тому

      Ok I found it : just cast the NavigationParameters as INavigationParametersInternal, then on the cast, perform the add and it will work :)
      Exemple given : ((INavigationParametersInternal)navigationParameters).Add("__NavigationMode", NavigationMode.New);

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      Glad you got it figured out.

  • @coderblog
    @coderblog 4 роки тому +1

    Thanks, I like it!

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      Thanks for watching

    • @coderblog
      @coderblog 4 роки тому +1

      @@BrianLagunas I will watch all of your Prism videos! Because I find that the Prism is great so I am starting to learn it, thanks! XDD

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      @@coderblog great! Let me know if you have any questions

    • @coderblog
      @coderblog 4 роки тому

      @@BrianLagunas I will, thanks a lot :)

  • @priyaan2560
    @priyaan2560 5 років тому +2

    Can we able to add collection in Navigated to implemented interface

    • @BrianLagunas
      @BrianLagunas  5 років тому +1

      Yes. It's no different than any other app you would write.

  • @zsoltnagy2227
    @zsoltnagy2227 4 роки тому

    Hi. Are you doing in the same way if you want to pass back data(object) from the Second page to the first page?

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      Yes, call gobackasync and pass your parameters

  • @andrewbeeman9083
    @andrewbeeman9083 4 роки тому

    Two Questions,
    1) are there any Tabbed navigation examples?
    2) I was attempting to set up the Resourced Dictionaries like I had before swapping to Prism and I get "A value of type 'Setter' cannot be added to a collection or dictionary of type 'IList` App.xamarin Prism Xamarin." Since you don't do any styling in any of the applications and there's no styling in any of the sample projects, should I assume styling isn't possible? I know that sounds strange but I ask seriously as I have see no examples of it with Prism and I'm getting these errors. One of the guys I work with does Prism on the WPF apps but he didn't know and hadn't seen in before.

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      Yes, we have plenty of samples. Just check out the sample repo: github.com/PrismLibrary/Prism-Samples-Forms
      Yes, you can style your Prism apps just like any other XF app. Prism does not do anything different or limit you in any way.

    • @andrewbeeman9083
      @andrewbeeman9083 4 роки тому

      @@BrianLagunas Do any of the samples have any styling? I couldn't find any. They were all also in 4.7, when I tried them in 4.8 I got errors. I know Gradient brushes are experimental to Xamarin but I've had them for years in other projects and don't really want to give them up.

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      Prism has no impact on styling. It literally has nothing to do with styling.

    • @andrewbeeman9083
      @andrewbeeman9083 4 роки тому

      @@BrianLagunas In your first video we replace the application.xaml markup with the prism:PrismApplication markup. After that nothing worked in Xam Forms 4.8. In Forms 4.7 it would run but would break if I had Styles with Setters in the Application.Resources.

    • @BrianLagunas
      @BrianLagunas  4 роки тому

      @@andrewbeeman9083 I've never had an issue with this. Like I said, Prism does not impact styling in anyway. If anything breaks it's going to be a Xamarin issue, or perhaps you are doing something incorrect.

  • @lopezcr0202
    @lopezcr0202 5 років тому +1

    thanks for the video :)

  • @rezamohamed2112
    @rezamohamed2112 5 років тому

    @Brian Lagunas when I simulate on the iOS simulator, i'm unable to get the Title 'Hello from Main Page' to render immediately on navigation to View A - works just fine on Android however.

    • @BrianLagunas
      @BrianLagunas  5 років тому

      Hard to say. If you feel you found a bug, please report it on the Prism github repo with a sample app to reproduce the issue.

    • @rezamohamed2112
      @rezamohamed2112 5 років тому

      @@BrianLagunas i'm just recreating the one line demo on these videos verbatim. I can't imagine its a bug - just trying to understand if it should work or not on iOS, and possibly trying to figure out why its giving issues on my end.

  • @crashnnburn
    @crashnnburn 5 років тому

    Hello, I have a quick question. How do I access the ViewModel from the code behind. I need to do stuff in the code behind (refresh a listview) while updating viewmodel variables. Anyone know?

    • @BrianLagunas
      @BrianLagunas  5 років тому +1

      If you absolutely must access the VM from code behind just cast the BindingContext. Var vm = (MyViewModel)BindingContext

    • @crashnnburn
      @crashnnburn 5 років тому +1

      @@BrianLagunas Thanks for the fast response. This did the trick! The only other thing I had to do in order for it to work is to use it in the OnAppearing method. If you try to use it in the constructor it won't work because the view is created before the ViewModel. Thanks again!