I've this issue where I have a button inside a CollectionView with a IsVisible property binding with my ViewModel and inside the Button there is also BindingContext and CommandParameter proprieties. The problem is that when I have BindingContext and CommandParameter the IsVisible propriety doesn't work.
XAML
<CollectionView
x:Name="collectionFriend"
ItemsSource="{Binding ListPerson}"
VerticalScrollBarVisibility="Never">
<CollectionView.ItemsLayout>
<LinearItemsLayout ItemSpacing="5" Orientation="Vertical" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid x:Name="GridPerson"
Padding="5"
BackgroundColor="White"
ColumnDefinitions="Auto,Auto,*"
RowDefinitions="*,Auto,Auto,Auto,Auto"
RowSpacing="5">
<Label
Grid.Column="1"
FontAttributes="Bold"
FontSize="15"
FontFamily="MontSemiBold"
Text="{Binding Name}"
TextColor="Black"
VerticalTextAlignment="Center" />
<Button
CornerRadius="4"
Grid.Row="2"
Grid.Column="1"
BackgroundColor="#5bd9d9"
FontSize="15"
WidthRequest="140"
HeightRequest="40"
IsVisible="{Binding Map}"
FontFamily="MontBold"
Text="{helpers:Translate ViewMap}"
BindingContext="{Binding Source={x:Reference collectionFriend}, Path=BindingContext}"
Command="{Binding MapCommand}"
CommandParameter="{Binding Source={x:Reference GridPerson}, Path=BindingContext}"
TextColor="White"
Padding="0">
</Button>
<Button
x:Name="PhotosPerson"
Grid.Row="3"
Grid.Column="1"
BackgroundColor="#3299d9"
FontSize="15"
WidthRequest="140"
HeightRequest="40"
CornerRadius="4"
IsVisible="{Binding Photos}"
FontFamily="MontBold"
Text="{helpers:Translate Photos}"
BindingContext="{Binding Source={x:Reference collectionFriend}, Path=BindingContext}"
Command="{Binding PhotosCommand}"
CommandParameter="{Binding Source={x:Reference GridPerson}, Path=BindingContext}"
TextColor="White"
Padding="0">
</Button>
<Line Grid.Row="4" Grid.ColumnSpan="3" BackgroundColor="#5a5a5a" HeightRequest="1" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
ViewModel
List<People> lista = new List<People>();
var result = await _tripRestService.GetPeople(UserTokenDbService.GetToken());
foreach (var item in result)
{
var person = new People()
{
Name = item.Name,
Photos = item.Photos,
Map = item.Map,
UriImage = image,
Id = item.Id
};
lista.Add(person);
ListPerson = new ObservableCollection<People>(lista.OrderBy(p => p.Name));
}