private void GetStoryboards()
{
if (root != null)
{
var groups = VisualStateManager.GetVisualStateGroups(root) as Collection<VisualStateGroup>;
if (groups != null)
{
var states = (from stategroup in groups
where stategroup.Name == FloatingWindow.VSMGROUP_Window
select stategroup.States).FirstOrDefault() as FreezableCollection<VisualState>;
if (states != null)
{
closingStoryboard = (from state in states
where state.Name == FloatingWindow.VSMSTATE_StateClosed
select state.Storyboard).FirstOrDefault();
openingStoryboard = (from state in states
where state.Name == FloatingWindow.VSMSTATE_StateOpen
select state.Storyboard).FirstOrDefault();
restoringStoryboard = (from state in states
where state.Name == FloatingWindow.VSMSTATE_StateRestored
select state.Storyboard).FirstOrDefault();
}
}
if (inertialMotionStoryboard == null)
inertialMotionStoryboard = new Storyboard();
if (maximizingStoryboard == null)
maximizingStoryboard = new Storyboard();
if (restoreMaximizedStoryboard == null)
restoreMaximizedStoryboard = new Storyboard();
}
}