Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro ao Navegar para Pagina

Elaborei uma pagina de Menu Lateral contendo uma lista de páginas para onde necessito desviar. A página Master do menu lateral é a seguinte:

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:pag="clr-namespace:Moshi.Telas"
             x:Class="Moshi.Telas.TelaIndice">
    <MasterDetailPage.Master>
        <pag:TelaIndiceMaster></pag:TelaIndiceMaster>
    </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <pag:TelaPrincipal></pag:TelaPrincipal>
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>

Com o seguinte Code Behind:

namespace Moshi.Telas
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class TelaIndice : MasterDetailPage
    {
        public TelaIndice ()
        {
            InitializeComponent ();
        }
    }
}

A pagina de Detalhe do Menu Lateral é a seguinte:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             Title="Índice Master"
             xmlns:tm="clr-namespace:Moshi.TelasModelos"
             x:Class="Moshi.Telas.TelaIndiceMaster">
    <ContentPage.BindingContext>
        <tm:IndiceMaster></tm:IndiceMaster>
    </ContentPage.BindingContext>
    <ContentPage.Content>
        <Frame OutlineColor="Silver"
               Margin="10">
            <StackLayout>
                <ListView x:Name="lisIndice" ItemsSource="{Binding ItensDoMenu}" SelectedItem="{Binding ClicOpcao}">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ViewCell.View>
                                    <StackLayout Orientation="Horizontal" VerticalOptions="Center">
                                        <Label Text="{Binding OpcaoMenu}"></Label>
                                    </StackLayout>
                                </ViewCell.View>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>            
        </Frame>

    </ContentPage.Content>
</ContentPage>

Com o seguinte Code Behind:

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Moshi.Telas
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class TelaIndiceMaster : ContentPage
    {
        public ImovelComprador imovelComprador { get; set; }
        public TelaImovelLista NavigationPage { get; private set; }

        public TelaIndiceMaster ()
        {
            InitializeComponent ();

        }

        protected override void OnAppearing()
        {
            base.OnAppearing();
            MessagingCenter.Subscribe<ItensMenu>(this, "OpcaoSelecionada",
            (msg) =>
            {
                if (msg.OpcaoMenu.Equals("Principal"))
                {
                    lisIndice.SelectedItem = null;
                    MessagingCenter.Send<Principal>(new Principal(), "VoltarPrincipal");
                }
                else if (msg.OpcaoMenu.Equals("Lista Imóveis"))
                {
                    lisIndice.SelectedItem = null;
                    MessagingCenter.Send<ImovelComprador>(new ImovelComprador(), "IrListaImovel");
                }
                else if (msg.OpcaoMenu.Equals("Recarga"))
                {
                    lisIndice.SelectedItem = null;
                    MessagingCenter.Send<Recarga>(new Recarga(), "IrParaRecarga");
                }
                else if (msg.OpcaoMenu.Equals("Usuário"))
                {
                    lisIndice.SelectedItem = null;
                    MessagingCenter.Send<Usuario>(new Usuario(), "IrParaUsuario");
                }
                else
                {
                    lisIndice.SelectedItem = null;
                    MessagingCenter.Send<Sair>(new Sair(), "Sair");
                }
            });
        }
        protected override void OnDisappearing()
        {
            base.OnDisappearing();
            MessagingCenter.Unsubscribe<ItensMenu>(this, "OpcaoSelecionada");
        }
    }
}

A página de App;.Xaml tem:

            MessagingCenter.Subscribe<ImovelComprador>(this, "IrListaImovel", (imovelComprador) =>
                {
                    MainPage = new NavigationPage(new Moshi.Telas.TelaImovelLista());
                });

Quando desvio para a página de Lista de Imóveis ("IrListaImovel") aparece o seguinte erro:

Unhandled Exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Alguem poderia me ajudar a solucionar o problema.

1 resposta
solução!

resolvido