ios – Xamarin forms databinding issues , view not updating


Im not using Binding context page or x:DataType for the whole page .Im using an x:DataType individual for each component. As you can see below :
the main issue is the first component behaves as expected , the second one and the third are not displaying or getting updated in the view . if I set each value in the vm on the initial load it will display . however it will never updates.

1.component is a map (it works and updates )
     <mainlocal:CustomMap.ItemTemplate>
                        <DataTemplate x:DataType="localone:PinData" >
                            <mainlocal:CustomPin PinId="{Binding PinId}"
                                              
                             Label="{Binding PinLabel}"
                             Position="{Binding PinPostion}"/>
            </DataTemplate>



<Label x:DataType="localsecond:BookVehicleInfo"
                                Grid.Row="0"  Text="{Binding VehicleName}"
                               FontSize="Large"
                               TextColor="white"
                               HorizontalOptions="Center"
                               VerticalOptions="Center">
                            <Label.BindingContext>
                                <localsecond:BookVehicleInfo />
                            </Label.BindingContext> </Label>
           

and :

public ObservableCollection<PinData> PinsCollection { get; set; } = new ObservableCollection<PinData>(); (works)
     public BookVehicleInfo person { get; } = new BookVehicleInfo(); (nope)

.

the event that updates both components is the following

private async move()
{
//this runs a service that updates both 
person.VehicleName = "service.update ";

}

Lastly,

 public class BookVehicleInfo : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            public string vehiclename { get; set; }
    }
     public void OnPropertyChanged(string name)
            {
                if (this.PropertyChanged != null)
                    this.PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
     public string VehicleName
            {
                get { return vehiclename; }
                set
                {
                    vehiclename = value;
                    OnPropertyChanged("VehicleName");
                }
            }
       

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img