private void LayoutRoot_MouseLeave(object sender, MouseEventArgs e) { if (!isPinned) { PushPin.Visibility = Visibility.Collapsed; if (RibbonExpand == null) { RibbonCollapse = root.Resources["RibbonCollapse"] as Storyboard; RibbonExpand.Completed += RibbonExpand_Completed; } RibbonCollapse.Begin(); } }