DXEvent

DXEvent is used when you need to define methods that should be called on an event.

Similar to DXBinding and a standard Binding, DXEvent works with the DataContext object by default.

<StackPanel>
    <StackPanel.DataContext>
        <local:ViewModel />
    </StackPanel.DataContext>
    <Button Content="OK" Loaded="{DXEvent Handler='Initialize()'}" />
    <Button Content="OK" Loaded="{DXEvent Handler='Initialize(); Load()'}" />
</StackPanel>

The Handler expression is specified with a special language that is described in the following topic: Language Specification.

You can pass any parameter to the calling methods.

<TextBlock x:Name="tb" Text="text"/>
<Button Content="OK" Loaded="{DXEvent Handler='Initialize(@e(tb).Text)'}"/>

To access the event sender and event arguments, use the @sender and @args reserved words.

<TextBlock x:Name="tb" Text="text"/>
<Button Content="OK" Loaded="{DXEvent Handler='Initialize(@sender.Content, @args, @e(tb).Text)'}"/>

The DXEvent extension supports the "=" operator.

<Button Click="{DXEvent '@e(checkBox).IsChecked=true'}"/>