private static void IsExpandedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { bool expanded = (bool)e.NewValue; PatientBanner panel = o as PatientBanner; if (panel != null) { if (expanded) { if (panel.Size != null) { SizeEventArgs se = new SizeEventArgs(new Size(0, panel._expandCollapseButton.ActualHeight), new Size(0, panel._expandCollapseButton.ActualHeight + panel._content.ActualHeight)); panel.Size(panel, se); } _ChangeState(panel, Expand, panel._RollDownStoryboardName); } else { if (panel.Size != null) { SizeEventArgs se = new SizeEventArgs(new Size(0, panel._expandCollapseButton.ActualHeight), new Size(0, panel._expandCollapseButton.ActualHeight)); panel.Size(panel, se); } _ChangeState(panel, Collapse, panel._RollUpStoryboardName); } } }
void panel_SizeChanging(object sender, SizeEventArgs e) { ExtenPanel panel = sender as ExtenPanel; ExtenPanel nextPanel = GetNextPanel(panel); if (panel != null && nextPanel != null) { double goToY = _GetElementTop(panel as UIElement) + e.New.Height + (panel as FrameworkElement).Margin.Bottom + (nextPanel as FrameworkElement).Margin.Top; _MovePanel(nextPanel, goToY); } }