Share via


RemoveElementAction Behavior (Compact 2013)

3/26/2014

You can use the RemoveElementAction behavior to easily remove an element from a logical tree in a XAML for Windows Embedded application. For example, the following XAML example shows you how to create a button that will be removed from the application entirely the first time the button is clicked.

<!-- This collection element might exist if you have already added other behaviors. -->
<i:Interaction.Triggers>

   <!-- Specify the name of the object (button) whose event will cause the property change.
      Also specify the event name (Click). -->
   <i:EventTrigger EventName="Click" SourceName="button">

      <!-- Specify the name of the object (button) which will be removed.-->
      <ei:RemoveElementAction TargetName="button"/>

   </i:EventTrigger>
</i:Interaction.Triggers>

Important

Subsequent invocations of the action will have no effect, because the element has already been removed from the tree.

See Also

Concepts

Expression Blend Behaviors in XAML for Windows Embedded
Behaviors, Actions, and Triggers