public static WindowExpander()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowExpander), new FrameworkPropertyMetadata(typeof(WindowExpander)));
     IsExpandedProperty.OverrideMetadata(typeof(WindowExpander), new FrameworkPropertyMetadata
     {
         PropertyChangedCallback = (obj, e) =>
         {
             var expander = (WindowExpander)obj;
             if (expander.Window != null)
             {
                 expander.SwapContent(expander.Window);
                 expander.AnimateWindow();
             }
         }
     });
 }
 public static WindowExpander()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowExpander), new PropertyMetadata(typeof(WindowExpander)));
     ContentProperty.OverrideMetadata(typeof(WindowExpander), new FrameworkPropertyMetadata
     {
         PropertyChangedCallback = (obj, e) =>
         {
             var expander  = (WindowExpander)obj;
             var oldWindow = (Window)e.OldValue;
             var newWindow = (Window)e.NewValue;
             if (oldWindow != null)
             {
                 if (!expander.IsExpanded)
                 {
                     expander.SwapContent(oldWindow);
                 }
                 oldWindow.StateChanged -= OnStateChanged;
             }
             expander.ConstructLiveThumbnail();
             if (newWindow != null)
             {
                 if (!expander.IsExpanded)
                 {
                     expander.SwapContent(newWindow);
                 }
                 newWindow.StateChanged -= OnStateChanged;
             }
         }
     });
     IsExpandedProperty.OverrideMetadata(typeof(WindowExpander), new FrameworkPropertyMetadata
     {
         PropertyChangedCallback = (obj, e) =>
         {
             var expander = (WindowExpander)obj;
             var window   = (Window)expander.Content;
             if (window != null)
             {
                 expander.SwapContent(window);
                 expander.AnimateWindow(window);
             }
         }
     });
 }
Example #3
0
 static DefaultExpandedExpander()
 {
     IsExpandedProperty.OverrideMetadata(typeof(DefaultExpandedExpander), new FrameworkPropertyMetadata(true));
 }