We are writing a Prism-based Silverlight application, and we have a whole bunch of pages in separate modules.
The transition between pages is done through navigation events, and each module implements the following methods to show the page during navigation and hide it during navigation:
public void Show()
{
VisualStateManager.GoToState(this, "ShowState", true);
}
public void Hide()
{
VisualStateManager.GoToState(this, "HideState", true);
}
Currently, "ShowState" and "HideState" are defined in each module of the XAML file, so they are duplicated too many times.
<Grid x:Name="LayoutRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStates">
<VisualState x:Name="ShowState">
...
</VisualState>
<VisualState x:Name="HideState">
...
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
Where ...represents Storyboardfor each transition.
Storyboard, . , Storyboard, .
, , .
VisualStateManager XAML?