Reputation: 1414
In the .NET MAUI Community Toolkit MVVM samples there is this XAML:
<Grid>
<muxc:InfoBar
x:Name="SuccessInfoBar"
Title="Success"
Message="The form was filled in correctly."
Severity="Success">
<interactivity:Interaction.Behaviors>
<interactions:EventTriggerBehavior EventName="FormSubmissionCompleted" SourceObject="{x:Bind ViewModel}">
<interactions:ChangePropertyAction
PropertyName="IsOpen"
TargetObject="{x:Bind SuccessInfoBar}"
Value="True" />
<interactions:ChangePropertyAction
PropertyName="IsOpen"
TargetObject="{x:Bind FailureInfoBar}"
Value="False" />
</interactions:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</muxc:InfoBar>
Can you tell me where I find documentation on EventTriggerBehavior? Or for that matter, where I find interactivity and Interaction.Behaviors and ChangePropertyAction?
I don't see this documented, despite searching.
Also, while I have you, this same code says
SourceObject="{x:Bind ViewModel}
Is Bind the same things as Binding?
Upvotes: 1
Views: 757
Reputation: 1589
EventTriggerBehavior: Listens for a specific event on its source and executes an action when the event is fired, it has two configurable properties (EventName
and SourceObject
).
ChangePropertyAction: Action that will change a specified property to a specified value when invoked.
For more information about Behaviors, you can check the documentation: XamlBehaviors
Regarding Bind and Binding, the {x:Bind} markup extension official document explains:
The {x:Bind} markup extension—new for Windows 10—is an alternative to {Binding}. {x:Bind} runs in less time and less memory than {Binding} and supports better debugging.
The difference to note is that the default mode of {x:Bind}
is OneTime
, which is different from {Binding}
, whose default mode is OneWay
.
For a comprehensive comparison between {x:Bind}
and {Binding}
, you can read Data binding in depth.
Upvotes: 1