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

INotifyPropertyChanged Event for nested Properties

$
0
0

Hi Guys,

i have the following situation:

OverviewPage.xaml:

 <Label>
           <Label.Triggers>
                  <DataTrigger TargetType="Label" Binding="{Binding VehicleState.Tires.TypeSelectedIndex}" Value="0">
                            <Setter Property="Text" Value="Summer" />
                  </DataTrigger>
           </Label.Triggers> > 
    </Label>

OverviewPageModel.cs has a Property:

    public VehicleStatePageModel VehicleState
    {
        get
        {
            return vehicleState;
        }
        set
        {
            vehicleState= value;
            OnPropertyChanged("VehicleState");
        }
    }

VehicleStatePageModel has a Property:

  public TiresPageModel Tires
        {
            get
            {
                return tires;
            }
            set
            {
                tires= value;
                OnPropertyChanged("Tires");
            }
        }

and TiresPageModel has a Property:

public int TypeSelectedIndex
{
get
{
return typeSelectedIndex;
}
set
{
if (typeSelectedIndex!= value)
{
typeSelectedIndex= value;
OnPropertyChanged("TypeSelectedIndex");
}
}
}

Now i have a TiresPage.xaml with a Picker whichs SelectedIndex Attribute is bound to the TypeSelectedIndex Property of TiresPageModel:

>! <Picker ItemsSource="{Binding TiresTypeList}" SelectedIndex="{Binding TypeSelectedIndex}"/>

If i change the value of the Picker the "OnPropertyChanged-Event" of the TypeSelectedIndex Property gets called.

But in my OverviewPage.xaml from the very first code snipped this binding:

>!  Binding="{Binding VehicleState.Tires.TypeSelectedIndex}"

dont gets refreshed.

Why is that?
Thanks, Gelatto


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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