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

Using ElementName on Binding gives me an error

$
0
0

Hi,

I'm using Xamarin.Forms.Behaviors and i'm trying to pass through the CommandParameter the SelectedItem to my ViewModel using RelayCommand, but always get an error saying:

"Xamarin.Forms.Xaml.XamlParseException: No Property of name ElementName found"

<ListView ItemsSource="{Binding Pharmacies}" x:Name ="Pharmacies_MyPharmacies" RowHeight="100" Grid.Row="0" Grid.Column="0">
    <b:Interaction.Behaviors>
      <b:BehaviorCollection>
        <b:EventToCommand EventName="ItemSelected" Command="{Binding PharmacySelectedCommand}" CommandParameter="{Binding SelectedItem, ElementName=Pharmacies_MyPharmacies}"/>
      </b:BehaviorCollection>
    </b:Interaction.Behaviors>
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <CustomControls:PharmacyControl PharmacyName="{Binding Name}" PharmacyAddress="{Binding FullAddress}" LogoSource="{Binding Logo}" IsSelected="{Binding IsSelected}" IsDefault="{Binding IsDefault}"></CustomControls:PharmacyControl>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

This is my List where i'm using the command, this works good on Windows c# XAML development, now i'm looking for a Xamarin.Forms solution for this.

Thanks,
Emanuel


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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