18.9 C
London
Wednesday, September 4, 2024

ios – Xamarin types databinding points , view not updating


Im not utilizing Binding context web page or x:DataType for the entire web page .Im utilizing an x:DataType particular person for every part. As you’ll be able to see under :
the principle difficulty is the primary part behaves as anticipated , the second and the third aren’t displaying or getting up to date within the view . if I set every worth within the vm on the preliminary load it’s going to show . nonetheless it’s going to by no means updates.

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



<Label x:DataType="localsecond:BookVehicleInfo"
                                Grid.Row="0"  Textual content="{Binding VehicleName}"
                               FontSize="Giant"
                               TextColor="white"
                               HorizontalOptions="Heart"
                               VerticalOptions="Heart">
                            <Label.BindingContext>
                                <localsecond:BookVehicleInfo />
                            </Label.BindingContext> </Label>
           

and :

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

.

the occasion that updates each elements is the next

personal async transfer()
{
//this runs a service that updates each 
particular person.VehicleName = "service.replace ";

}

Lastly,

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

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here