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

RelativeSource in XAML

$
0
0

Hello,

I know that this is currently not implemented in Xamarin.Forms: https://xamarin.uservoice.com/forums/258559-xamarin-forms-suggestions/suggestions/6451625-support-for-relativesource-in-xaml-binding

But I tried the suggested workarounds stated here: https://forums.xamarin.com/discussion/comment/111746/#Comment_111746
and can't find them to work.

I have the following setup:

<ContentPage>
    <ListView.ItemTemplate x:Name="MyList"  ItemsSource="{Binding XyList}">
          <DataTemplate>
            <cells:MyCustomCell />
          </DataTemplate>
        </ListView.ItemTemplate>
</ContentPage>

MyCustomCell cell:

<ViewCell>
        <Label Text="{Binding Path=SomeProperty, Source={util:RelativeContext MyList}" />
</ViewCell>

When debugging into the MarkupExtensions the "rootProvider.RootObject" has no parent/child elements and therefore FindByName returns null.

So I have no chance to access a property on my ViewModel when using a custom ViewCell?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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