I have a ListView in my Xamarin.Forms project and I want to enable a button only if there is a selected item in the list view. I tried adding DataTrigger for my Button that checks for SelectedItem Value if it is null or not but this does not work
<StackLayout Orientation="Vertical">
<ListView x:Name="lvwCars" ItemsSource="{Binding Cars}"
SelectedItem="{Binding SelectedCar}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding PlateNumber}" />
<Label Text="{Binding OwnerName}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Button x:Name="btnBack"
Text="Back"
Command="{Binding BackClickCommand}"/>
<Button x:Name="btnNext"
Text="Next"
IsEnabled="False"
Command="{Binding ConfirmClickCommand}">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding Source={x:Reference lvwCars}, Path=SelectedItem}" Value="null">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Button.Triggers>
</Button>
</StackLayout>