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

Can't tell which menu item is selected on Master Detail page

$
0
0

I have a menu that looks like this:

<ListView x:Name="listView" ItemsSource="{Binding MenuItems}" x:FieldModifier="public" Margin="5" HasUnevenRows="True" SeparatorVisibility="None" BackgroundColor="Transparent">

               <ListView.ItemTemplate>
                  <DataTemplate>
                     <ViewCell>
                        <Frame HorizontalOptions="CenterAndExpand" BackgroundColor="#939598" Padding="5" Margin="5" WidthRequest="254">
                           <Grid Padding="2" RowSpacing="2" ColumnSpacing="2" Margin="2">
                              <Grid.ColumnDefinitions>
                                 <ColumnDefinition Width="34" />
                                 <ColumnDefinition Width="*" />
                              </Grid.ColumnDefinitions>
                              <Image Source="{Binding IconSource}" Aspect="AspectFill" />
                              <Label Grid.Column="1" Text="{Binding Title}" FontAttributes="Bold" FontSize="Medium" TextColor="#D7D8D9" />
                           </Grid>
                        </Frame>
                     </ViewCell>
                  </DataTemplate>
               </ListView.ItemTemplate>
            </ListView>

Items are added to the menu programmatically:

         string[] areas = AreaNames.Split(',');
         for (int i = 0; i < areas.Length; i++)
            MenuItems.Add(new MasterPageItem { Title = areas[i], IconSource = "vehiclelist.png", TargetType = typeof(VehiclesListPage) });

This works, but when a VehiclesListPage is created, I have no idea which area the user has selected. How do I know what area is selected?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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