Send Text value from 2 Labels using Command inside BindableLayout

64 Views Asked by At

I'm working with MVVM and I have a bindablelayout like this:

 <StackLayout Margin="20" BindableLayout.ItemsSource="{Binding MyApartments}" >
      <BindableLayout.ItemTemplate>
         <DataTemplate>

           <StackLayout Margin="0,10,0,0">
              <Frame Padding="15" HasShadow="True" BackgroundColor="WhiteSmoke" HorizontalOptions="Fill" VerticalOptions="CenterAndExpand" HeightRequest="150" CornerRadius="15">
                  <StackLayout x:Name="AptItems">
                    <Label x:Name="apartmentlabel" Text="{Binding MyApartments.apartment}" Margin="0,15,0,0" FontFamily="{StaticResource mon_extrabold}" TextColor="DarkBlue" FontSize="Title"/>
                    <Label x:Name="numberlabel" Text="{Binding MyApartments.number}" FontFamily="{StaticResource mon_bold}" TextColor="DarkBlue" FontSize="Subtitle"/>
                    <Button HorizontalOptions="End" FontFamily="{StaticResource mon_regular}" BackgroundColor="{StaticResource bounty}" TextColor="White" Command="{Binding Path=BindingContext.SelectApartment, Source={x:Reference ApartmentsPage}}"/>
                  </StackLayout>
             </Frame>
         </StackLayout>

       </DataTemplate>
     </BindableLayout.ItemTemplate>
   </StackLayout>

I need to save the value in buildinglabel and numberlabel to my preferences but I don't know how to pass both labels to a command and searched for a long time now with no success, how is it done?

0

There are 0 best solutions below