Actions
Sometimes you want to change some aspect of the widget when a certain event occurs (like a button press). This is what ActionList and Action are for. An ActionList can be coupled to an event and contains – you guessed it – a list of Actions. An action can be used to set the property of an element or to fire a Trigger.
For example:
<VisualBook Name="book" CurrentPage="page1"> <VisualPage Name="page1"> <VisualContent> <VisualText Text="Page 1"/> <VisualButton Padding="3" Clicked="buttonpage1clicked"> <VisualText Text="go to page 2"/> </VisualButton> </VisualContent> </VisualPage> <VisualPage Name="page2"> <VisualContent> <VisualText Text="Page 2"/> <VisualButton Padding="3" Clicked="buttonpage2clicked"> <VisualText Text="go to page 1"/> </VisualButton> </VisualContent> </VisualPage> </VisualBook> <ActionList Name="buttonpage1clicked"> <Action Subject="book" Attribute="CurrentPage" AttributeValue="page2"/> </ActionList> <ActionList Name="buttonpage2clicked"> <Action Subject="book" Attribute="CurrentPage" AttributeValue="page1"/> </ActionList>
In the example above, the buttons can be used to switch between pages.
