Data Binding – Binding for Events

<Button Click=“PokeEmployee„>Poke Employee</Button>

<Button Click=“{x:Bind Model.ManagerProp.Reports[0].Poke}“>Poke Employee</Button>

Signature needs to:

  • Have no Parameters
    • void Poke() {…}
  • Or match the Event Parameters
    • void Poke(object Sender, RouteEventArgs e)  {…}
  • Or match the Event Parameters with base Types
    • void Poke(object Sender, object e)  {…}
  • Overloading is not supported
  • Supports all Event
  • Replaces ICommand

Sample

<DataTemplate x:DataType=“model:IEmployee„>

<Grid …>

<Button Click=“x:Bind Poke}“>Poke</Button>

</Grid>

</DataTemplate>

Poke is defined in IEmployee!!!