Xamarin.forms: Support binding to attached BP

Created on 24 Jan 2018  Â·  8Comments  Â·  Source: xamarin/Xamarin.Forms

The current Binding system doesn't allow to use an attached bindable property as binding source, like in

<Grid>
    <Label x:Name="label0" Grid.Row="1"/>
    <Label Text="{Binding (Grid.Row), Source={x:Reference label0}}" />
</Grid>

Of course, it can be combined as part of a complex path

<Label Text="{Binding label0.(Grid.Row)}" />

If the attached BP owner type is not in the default xmlns, the type has to be prefixed

<Label Text="{Binding label0.(local:MyLayout.Altitude)}" />

For this reason, this syntax is restricted to xaml only.

Challenges:

  • attach changed handlers to attached BPs
  • keep the current bindings working while refactoring

Formal syntax for Binding Path

_part-element-list_:

  • _empty_
  • _part-separator_
  • _first-part_ _part-list_(opt)

_empty_:

_part-separator_:

  • .

_first-part_:

  • _part_
  • _part-separator_ _part_

_part-list_:

  • _part-separator_ _part_
  • _part-separator_ _part_ _part-list_(opt)

_part_:

  • _part-id_
  • _indexer_

_part-id_:

  • identifier
  • (_type_._bp_)

_type_:

  • identifier
  • xmlnsprefix:identifier

_indexer_:

  • _part_id_[index]
binding ⛓ help wanted high impact proposal-accepted enhancement ➕ up-for-grabs

Most helpful comment

When is this planned for fixing?

All 8 comments

This issue is listed for the x:Bind project:
https://github.com/xamarin/Xamarin.Forms/projects/7

What is the current status of the x:bind implementation?

When is this planned for fixing?

Bump

Any news on that?

I am also looking for this feature to work as well.

Same here

Nooo! I _just_ needed to use this in my templated view!

Could be 5.0.0 candidate?

Was this page helpful?
0 / 5 - 0 ratings