src/Foundation/Presentation/Gimela.Presentation.Controls/Controls/MDI/MDIChild.cs
/// <summary>
/// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
/// </summary>
When overridden in a derived class, is invoked whenever application code or internal processes call .
When overridden in a derived class is invoked whenever application code or internal processes call .
public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();
      minimizeButton = (ToggleButton)Template.FindName("MinimizeButton", this);
      maximizeButton = (ToggleButton)Template.FindName("MaximizeButton", this);
      closeButton = (Button)Template.FindName("CloseButton", this);
      buttonsPanel = (StackPanel)Template.FindName("ButtonsPanel", this);
      if (minimizeButton != null)
        minimizeButton.Click += new RoutedEventHandler(minimizeButton_Click);
      if (maximizeButton != null)
        maximizeButton.Click += new RoutedEventHandler(maximizeButton_Click);
      if (closeButton != null)
        closeButton.Click += new RoutedEventHandler(closeButton_Click);
      Thumb dragThumb = (Thumb)Template.FindName("DragThumb", this);
      if (dragThumb != null)
      {
        dragThumb.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        dragThumb.DragDelta += new DragDeltaEventHandler(dragThumb_DragDelta);
        dragThumb.MouseDoubleClick += (sender, e) =>
        {
          if (WindowState == WindowState.Minimized)
            minimizeButton_Click(null, null);
          else if (WindowState == WindowState.Normal)
            maximizeButton_Click(null, null);
        };
      }
      Thumb resizeLeft = (Thumb)Template.FindName("ResizeLeft", this);
      Thumb resizeTopLeft = (Thumb)Template.FindName("ResizeTopLeft", this);
      Thumb resizeTop = (Thumb)Template.FindName("ResizeTop", this);
      Thumb resizeTopRight = (Thumb)Template.FindName("ResizeTopRight", this);
      Thumb resizeRight = (Thumb)Template.FindName("ResizeRight", this);
      Thumb resizeBottomRight = (Thumb)Template.FindName("ResizeBottomRight", this);
      Thumb resizeBottom = (Thumb)Template.FindName("ResizeBottom", this);
      Thumb resizeBottomLeft = (Thumb)Template.FindName("ResizeBottomLeft", this);
      if (resizeLeft != null)
      {
        resizeLeft.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeLeft.DragDelta += new DragDeltaEventHandler(ResizeLeft_DragDelta);
      }
      if (resizeTop != null)
      {
        resizeTop.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeTop.DragDelta += new DragDeltaEventHandler(ResizeTop_DragDelta);
      }
      if (resizeRight != null)
      {
        resizeRight.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeRight.DragDelta += new DragDeltaEventHandler(ResizeRight_DragDelta);
      }
      if (resizeBottom != null)
      {
        resizeBottom.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeBottom.DragDelta += new DragDeltaEventHandler(ResizeBottom_DragDelta);
      }
      if (resizeTopLeft != null)
      {
        resizeTopLeft.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeTopLeft.DragDelta += (sender, e) =>
        {
          ResizeTop_DragDelta(null, e);
          ResizeLeft_DragDelta(null, e);
          Container.InvalidateSize();
        };
      }
      if (resizeTopRight != null)
      {
        resizeTopRight.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeTopRight.DragDelta += (sender, e) =>
        {
          ResizeTop_DragDelta(null, e);
          ResizeRight_DragDelta(null, e);
          Container.InvalidateSize();
        };
      }
      if (resizeBottomRight != null)
      {
        resizeBottomRight.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeBottomRight.DragDelta += (sender, e) =>
        {
          ResizeBottom_DragDelta(null, e);
          ResizeRight_DragDelta(null, e);
          Container.InvalidateSize();
        };
      }
      if (resizeBottomLeft != null)
      {
        resizeBottomLeft.DragStarted += new DragStartedEventHandler(Thumb_DragStarted);
        resizeBottomLeft.DragDelta += (sender, e) =>
        {
          ResizeBottom_DragDelta(null, e);
          ResizeLeft_DragDelta(null, e);
          Container.InvalidateSize();
        };
      }
      MinimizeBoxValueChanged(this, new DependencyPropertyChangedEventArgs(MinimizeBoxProperty, true, MinimizeBox));
      MaximizeBoxValueChanged(this, new DependencyPropertyChangedEventArgs(MaximizeBoxProperty, true, MaximizeBox));
    }
public override void OnApplyTemplate ( ) { base . OnApplyTemplate ( ) ; minimizeButton = ( ToggleButton ) Template . FindName ( " " , this ) ; maximizeButton = ( ToggleButton ) Template . FindName ( " " , this ) ; closeButton = ( Button ) Template . FindName ( " " , this ) ; buttonsPanel = ( StackPanel ) Template . FindName ( " " , this ) ; if ( minimizeButton != null ) minimizeButton . Click += new RoutedEventHandler ( minimizeButton_Click ) ; if ( maximizeButton != null ) maximizeButton . Click += new RoutedEventHandler ( maximizeButton_Click ) ; if ( closeButton != null ) closeButton . Click += new RoutedEventHandler ( closeButton_Click ) ; Thumb dragThumb = ( Thumb ) Template . FindName ( " " , this ) ; if ( dragThumb != null ) { dragThumb . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; dragThumb . DragDelta += new DragDeltaEventHandler ( dragThumb_DragDelta ) ; dragThumb . MouseDoubleClick += ( sender , e ) => { if ( WindowState == WindowState . Minimized ) minimizeButton_Click ( null , null ) ; else if ( WindowState == WindowState . Normal ) maximizeButton_Click ( null , null ) ; } ; } Thumb resizeLeft = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeTopLeft = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeTop = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeTopRight = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeRight = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeBottomRight = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeBottom = ( Thumb ) Template . FindName ( " " , this ) ; Thumb resizeBottomLeft = ( Thumb ) Template . FindName ( " " , this ) ; if ( resizeLeft != null ) { resizeLeft . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeLeft . DragDelta += new DragDeltaEventHandler ( ResizeLeft_DragDelta ) ; } if ( resizeTop != null ) { resizeTop . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeTop . DragDelta += new DragDeltaEventHandler ( ResizeTop_DragDelta ) ; } if ( resizeRight != null ) { resizeRight . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeRight . DragDelta += new DragDeltaEventHandler ( ResizeRight_DragDelta ) ; } if ( resizeBottom != null ) { resizeBottom . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeBottom . DragDelta += new DragDeltaEventHandler ( ResizeBottom_DragDelta ) ; } if ( resizeTopLeft != null ) { resizeTopLeft . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeTopLeft . DragDelta += ( sender , e ) => { ResizeTop_DragDelta ( null , e ) ; ResizeLeft_DragDelta ( null , e ) ; Container . InvalidateSize ( ) ; } ; } if ( resizeTopRight != null ) { resizeTopRight . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeTopRight . DragDelta += ( sender , e ) => { ResizeTop_DragDelta ( null , e ) ; ResizeRight_DragDelta ( null , e ) ; Container . InvalidateSize ( ) ; } ; } if ( resizeBottomRight != null ) { resizeBottomRight . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeBottomRight . DragDelta += ( sender , e ) => { ResizeBottom_DragDelta ( null , e ) ; ResizeRight_DragDelta ( null , e ) ; Container . InvalidateSize ( ) ; } ; } if ( resizeBottomLeft != null ) { resizeBottomLeft . DragStarted += new DragStartedEventHandler ( Thumb_DragStarted ) ; resizeBottomLeft . DragDelta += ( sender , e ) => { ResizeBottom_DragDelta ( null , e ) ; ResizeLeft_DragDelta ( null , e ) ; Container . InvalidateSize ( ) ; } ; } MinimizeBoxValueChanged ( this , new DependencyPropertyChangedEventArgs ( MinimizeBoxProperty , true , MinimizeBox ) ) ; MaximizeBoxValueChanged ( this , new DependencyPropertyChangedEventArgs ( MaximizeBoxProperty , true , MaximizeBox ) ) ; }
When overridden in a derived class, is invoked whenever application code or internal processes call .
When overridden in a derived class is invoked whenever application code or internal processes call .