XAML Master Detail in MVVM Light example

GaganSinghGaganSingh USUniversity ✭✭✭

Are there any examples of a master detail navigation using XAML and MVVM Light?
Currently im looking at Hanselman.Forms and this guide

But they aren't using XAML for the master detail page.

Best Answer

Answers

  • Pierre-ChristopheDusPierre-ChristopheDus FRUniversity ✭✭✭

    @GaganSingh
    Do you have found something? I look for the same thing...

  • GaganSinghGaganSingh USUniversity ✭✭✭

    No i have not. Im just doing it the way its done in Hanselman.Forms

  • xinmengxinmeng GBMember ✭✭

    Try this Repository

    https://github.com/danhermes/xamarin-book-examples/tree/master/Chapter%206%20-%20Navigation

    this is base on the book Xamarin Mobile Application Development, I think this book is one of the best books about XF. The book use code, but there is a XAML version of sample code in this repository, so you can also compare between them!

    I just finish a MasterDetail style with MVVM , if you have any question, could leave message to me.

  • Maharshi.5212Maharshi.5212 USMember ✭✭

    How to make Persistent navigation drawers in android using xamarin forms

  • DeveshMishraDeveshMishra USMember ✭✭

    @GaganSingh said:
    i think the Hanselman.Forms is the best example for MVVM XAML masterdetail page because it separates the code pretty well. I was hoping to create a XAML version of the RootPage in Hanselman.Forms. But while going through the code more thoroughly, i think its designed that way because its in an MVVM architecture. I guess you could make the RootPage in XAML. But it would probably create more complications.

    Note: The example you gave is pretty similar to how its done in the Hanselman.Forms example.

    Hi Gagan,

    I have seen the Hanselman.Forms code because i am also looking for such kind of implementation. I can see that everytime it is creating a new Navigation Page once i click on Master list item.

    Can you please explain me how it's the best solution from Memory management point of view ?

  • GaganSinghGaganSingh USUniversity ✭✭✭
    > @DeveshMishra said:
    > @GaganSingh said:
    > i think the Hanselman.Forms is the best example for MVVM XAML masterdetail page because it separates the code pretty well. I was hoping to create a XAML version of the RootPage in Hanselman.Forms. But while going through the code more thoroughly, i think its designed that way because its in an MVVM architecture. I guess you could make the RootPage in XAML. But it would probably create more complications.
    >
    > Note: The example you gave is pretty similar to how its done in the Hanselman.Forms example.
    >
    >
    >
    >
    >
    > Hi Gagan,
    >
    > I have seen the Hanselman.Forms code because i am also looking for such kind of implementation. I can see that everytime it is creating a new Navigation Page once i click on Master list item.
    >
    > Can you please explain me how it's the best solution from Memory management point of view ?

    It's not. It's by far the most buggiest piece of code I have ever seen. We used it in our app about a year ago and just about a week ago we ended scrapping the whole thing because of performance issues with xamarin.forms. Dont go this route. You may think it's awesome reusing UI code but ur gona have infinite headaches down the line. I highly recommend going full native. Xamarin native is great but there isn't many libraries for u to leverage without spending time recreating or creating bindings for them. It's a waste of time. I know this doesn't answer ur question but it's the best advice I could give.
  • NMackayNMackay GBInsider, University mod
    edited March 2017

    @DeveshMishra

    I'd recommend Prism if your targeting Forms.

    It allows your to implement MasterDetail without much pain and it has nice features like IDestructible to handle page cleanup when your navigatign to different detail pages.

    Also worth noting we have two MVVM Light Forms apps in production with no memory management issues so I'd have to counter the advice you've been given above.

  • GaganSinghGaganSingh USUniversity ✭✭✭
    > @NMackay said:
    > @DeveshMishra
    >
    > I'd recommend Prism if your targeting Forms.
    >
    > It allows your to implement MasterDetail without much pain and it has nice features like IDestructible to handle page cleanup when your navigatign to different detail pages.
    >
    > Also worth noting we have two MVVM Light Forms apps in production with no memory management issues so I'd have to counter the advice you've been given above


    I guess it depends on the complexity of your app. We had detailed ui requirements.
    Good luck finding a prism example for a master detail page.
  • NMackayNMackay GBInsider, University mod

    Well our Prism app has 9 modules, a pretty complex navigation scheme and has security concepts to allow dashboard to automatically discover widgets in modules based on security rights and consumes multiple Restful endpoints.

    It's a MasterDetail app....and it targets iOS, Android and UWP and seems to be working pretty well.

    The prism sample source code has a masterdetail example...you don't have to look to far.

    I don't mind knocking up a sample if anyone is looking for it though.

  • GaganSinghGaganSingh USUniversity ✭✭✭
    > @NMackay said:
    > Well our Prism app has 9 modules, a pretty complex navigation scheme and has security concepts to allow dashboard to automatically discover widgets in modules based on security rights and consumes multiple Restful endpoints.
    >
    > It's a MasterDetail app....and it targets iOS, Android and UWP and seems to be working pretty well.
    >
    > The prism sample source code has a masterdetail example...you don't have to look to far.
    >
    > I don't mind knocking up a sample if anyone is looking for it though.

    Could you provide links to your forms apps. I'd like to see if you've experienced similar performance issues regarding navigation in xamarin forms. Thanks!
  • NMackayNMackay GBInsider, University mod

    @GaganSingh said:

    @NMackay said:
    Well our Prism app has 9 modules, a pretty complex navigation scheme and has security concepts to allow dashboard to automatically discover widgets in modules based on security rights and consumes multiple Restful endpoints.

    It's a MasterDetail app....and it targets iOS, Android and UWP and seems to be working pretty well.

    The prism sample source code has a masterdetail example...you don't have to look to far.

    I don't mind knocking up a sample if anyone is looking for it though.


    Could you provide links to your forms apps. I'd like to see if you've experienced similar performance issues regarding navigation in xamarin forms. Thanks!

    No, they are internal business apps.

  • GaganSinghGaganSingh USUniversity ✭✭✭
    > @NMackay said:
    > @GaganSingh said:
    >
    > @NMackay said:
    > Well our Prism app has 9 modules, a pretty complex navigation scheme and has security concepts to allow dashboard to automatically discover widgets in modules based on security rights and consumes multiple Restful endpoints.
    >
    > It's a MasterDetail app....and it targets iOS, Android and UWP and seems to be working pretty well.
    >
    > The prism sample source code has a masterdetail example...you don't have to look to far.
    >
    > I don't mind knocking up a sample if anyone is looking for it though.
    >
    >
    >
    >
    >
    >
    > Could you provide links to your forms apps. I'd like to see if you've experienced similar performance issues regarding navigation in xamarin forms. Thanks!
    >
    >
    >
    >
    >
    > No, they are internal business apps.

    Do you have any git hub projects that can demonstrate prism mvvm master detail page? I wana see if the same issue exists. Because the issue we were experiencing was the master detail page, on page change, was loading the page first and the animation for the drawer closing was stuttering and lagging. And according to Microsoft support, that's how the master detail page is structured. I was told to look at the renderer for the master detail page and modify that. I don't have time to fix xamarin's bugs. Yes I know this is related to xamarin controls rather than mvvm light itself, hence the reason I initially said to stay away from xamarin.
  • NMackayNMackay GBInsider, University mod

    @GaganSingh

    I'll try and post a sample up, I meant to post a Prism and MVVM Light sample but I haven't had time.

  • DeveshMishraDeveshMishra USMember ✭✭

    @GaganSingh said:

    @DeveshMishra said:
    @GaganSingh said:
    i think the Hanselman.Forms is the best example for MVVM XAML masterdetail page because it separates the code pretty well. I was hoping to create a XAML version of the RootPage in Hanselman.Forms. But while going through the code more thoroughly, i think its designed that way because its in an MVVM architecture. I guess you could make the RootPage in XAML. But it would probably create more complications.

    Note: The example you gave is pretty similar to how its done in the Hanselman.Forms example.

    Hi Gagan,

    I have seen the Hanselman.Forms code because i am also looking for such kind of implementation. I can see that everytime it is creating a new Navigation Page once i click on Master list item.

    Can you please explain me how it's the best solution from Memory management point of view ?


    It's not. It's by far the most buggiest piece of code I have ever seen. We used it in our app about a year ago and just about a week ago we ended scrapping the whole thing because of performance issues with xamarin.forms. Dont go this route. You may think it's awesome reusing UI code but ur gona have infinite headaches down the line. I highly recommend going full native. Xamarin native is great but there isn't many libraries for u to leverage without spending time recreating or creating bindings for them. It's a waste of time. I know this doesn't answer ur question but it's the best advice I could give.

    Hi Gagan,

    Thanks for your advice. What do you mean by Xamarin Native ?
    Do you mean to say that for Android apps, i should use Xamarin Android and for IOS apps i should use Xamarin IOS rather than using Xamarin Forms ??

  • DeveshMishraDeveshMishra USMember ✭✭

    @GaganSingh said:

    @NMackay said:
    @DeveshMishra

    I'd recommend Prism if your targeting Forms.

    It allows your to implement MasterDetail without much pain and it has nice features like IDestructible to handle page cleanup when your navigatign to different detail pages.

    Also worth noting we have two MVVM Light Forms apps in production with no memory management issues so I'd have to counter the advice you've been given above



    I guess it depends on the complexity of your app. We had detailed ui requirements.
    Good luck finding a prism example for a master @DeveshMishra

    Hi Norman/Gagan

    We all here discussing something which is related to memory management and application performance. Now suppose, if i don't use a master detail page, then will it solve these issues. Is it because of only Master Detail Page or is it something that Xamarin Forms works in this way only ??

    Norman, it would be really great if you can post some sample using Prism.

  • GaganSinghGaganSingh USUniversity ✭✭✭
    > @DeveshMishra said:
    > @GaganSingh said:
    >
    > @DeveshMishra said:
    > @GaganSingh said:
    > i think the Hanselman.Forms is the best example for MVVM XAML masterdetail page because it separates the code pretty well. I was hoping to create a XAML version of the RootPage in Hanselman.Forms. But while going through the code more thoroughly, i think its designed that way because its in an MVVM architecture. I guess you could make the RootPage in XAML. But it would probably create more complications.
    >
    > Note: The example you gave is pretty similar to how its done in the Hanselman.Forms example.
    >
    >
    >
    > Hi Gagan,
    >
    > I have seen the Hanselman.Forms code because i am also looking for such kind of implementation. I can see that everytime it is creating a new Navigation Page once i click on Master list item.
    >
    > Can you please explain me how it's the best solution from Memory management point of view ?
    >
    >
    >
    >
    >
    >
    > It's not. It's by far the most buggiest piece of code I have ever seen. We used it in our app about a year ago and just about a week ago we ended scrapping the whole thing because of performance issues with xamarin.forms. Dont go this route. You may think it's awesome reusing UI code but ur gona have infinite headaches down the line. I highly recommend going full native. Xamarin native is great but there isn't many libraries for u to leverage without spending time recreating or creating bindings for them. It's a waste of time. I know this doesn't answer ur question but it's the best advice I could give.
    >
    >
    >
    >
    >
    > Hi Gagan,
    >
    > Thanks for your advice. What do you mean by Xamarin Native ?
    > Do you mean to say that for Android apps, i should use Xamarin Android and for IOS apps i should use Xamarin IOS rather than using Xamarin Forms ??

    Exactly. If you really want to use xamarin. I recommend using xamarin native. I also recommend making a POC for xamarin native and full native. Just to make sure it meets ur performance needs as well as ur design requirements.
  • DeveshMishraDeveshMishra USMember ✭✭

    @GaganSingh said:

    @DeveshMishra said:
    @GaganSingh said:

    @DeveshMishra said:
    @GaganSingh said:
    i think the Hanselman.Forms is the best example for MVVM XAML masterdetail page because it separates the code pretty well. I was hoping to create a XAML version of the RootPage in Hanselman.Forms. But while going through the code more thoroughly, i think its designed that way because its in an MVVM architecture. I guess you could make the RootPage in XAML. But it would probably create more complications.

    Note: The example you gave is pretty similar to how its done in the Hanselman.Forms example.

    Hi Gagan,

    I have seen the Hanselman.Forms code because i am also looking for such kind of implementation. I can see that everytime it is creating a new Navigation Page once i click on Master list item.

    Can you please explain me how it's the best solution from Memory management point of view ?


    It's not. It's by far the most buggiest piece of code I have ever seen. We used it in our app about a year ago and just about a week ago we ended scrapping the whole thing because of performance issues with xamarin.forms. Dont go this route. You may think it's awesome reusing UI code but ur gona have infinite headaches down the line. I highly recommend going full native. Xamarin native is great but there isn't many libraries for u to leverage without spending time recreating or creating bindings for them. It's a waste of time. I know this doesn't answer ur question but it's the best advice I could give.

    Hi Gagan,

    Thanks for your advice. What do you mean by Xamarin Native ?
    Do you mean to say that for Android apps, i should use Xamarin Android and for IOS apps i should use Xamarin IOS rather than using Xamarin Forms ??


    Exactly. If you really want to use xamarin. I recommend using xamarin native. I also recommend making a POC for xamarin native and full native. Just to make sure it meets ur performance needs as well as ur design requirements.

    Look, the main reason behind using Xamarin Forms to create cross platform apps. And i am sure that Xamarin Native would produce better apps compared to Forms. I won't be able to achive cross platform apps using native.

  • DeveshMishraDeveshMishra USMember ✭✭

    Hi All,

    Finally i found one solution for Master Details pages using only one instance of Navigation Page in Xamarin Forms. It's pretty simple without using any framewok.

    Let me know, if anyone looking for the same.

  • @DeveshMishra said:
    Hi All,

    Finally i found one solution for Master Details pages using only one instance of Navigation Page in Xamarin Forms. It's pretty simple without using any framewok.

    Let me know, if anyone looking for the same.

    Y, I would love to see the example. Running into one issue after the other when using Xamarin.Forms.MasterDetailPage approach :-(

  • DeveshMishraDeveshMishra USMember ✭✭

    @TillBallendat.0434 said:

    @DeveshMishra said:
    Hi All,

    Finally i found one solution for Master Details pages using only one instance of Navigation Page in Xamarin Forms. It's pretty simple without using any framewok.

    Let me know, if anyone looking for the same.

    Y, I would love to see the example. Running into one issue after the other when using Xamarin.Forms.MasterDetailPage approach :-(

    I don't have example ready to share, it will take more time to build. In the mean while, you can tell me about your issues. May be i could you help you.

  • Thx,
    I figured something out, that kind of workes for me:

    • NOT using App = new NavigationPage(new MyMasterDetailPage)
    • performing all modal as well as hierarchical navigation on _myNavigationPageInstance.Detail.Navigation

    -> the only issue I am facing when doing a Hierarchical navigation on the NavigationPage that wraps the current Detail Page instead of doing it on a NavigationPage, that wraps the whole MasterDetailPage: The Menu of MasterDetailPage still shows.

Sign In or Register to comment.