Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

second masterdetailpage is not responding

$
0
0

Hi Xamarin forum

I tried to create another masterdetailpage for the logged in members I have successfully recreate the UI for masterdetailpage but it doesnt responds when I try to tap for example the Home on its list Here is my code

<ListView x:Name="listView2"> <ListView.ItemsSource> <x:Array Type="{x:Type local:MasterPageItem}" x:Name="defaultList"> <local:MasterPageItem Title="Home Page" TargetType="{x:Type local:MainPage}" /> <local:MasterPageItem Title="Log Out" TargetType="{x:Type local:Logout}" /> </x:Array> </ListView.ItemsSource> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Padding="5,10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Source="{Binding IconSource}" /> <Label Grid.Column="1" Text="{Binding Title}" TextColor="White" /> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

My LoggedMenuCS.cs

`
{
public ListView ListView { get { return listView; } }

    ListView listView;

    public LoggedMenuCS ()
    {
        var masterPageItems = new List<LoggedInItem>();
        masterPageItems.Add(new LoggedInItem
        {
            Title = "Home",
            TargetType = typeof(MainPageCS)
        });
        masterPageItems.Add(new LoggedInItem
        {
            Title = "Log Out",
            TargetType = typeof(LogoutCS)
        });

        listView = new ListView
        {
            ItemsSource = masterPageItems,
            ItemTemplate = new DataTemplate(() =>
            {
                var grid = new Grid { Padding = new Thickness(5, 10) };
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });

                var image = new Image();
                image.SetBinding(Image.SourceProperty, "IconSource");
                var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
                label.SetBinding(Label.TextProperty, "Title");

                grid.Children.Add(image);
                grid.Children.Add(label, 1, 0);

                return new ViewCell { View = grid };
            }),
            SeparatorVisibility = SeparatorVisibility.None
        };

    }
}

`


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>