XamDockManager- handling closing Document event triggerd by DocumentCloseButton

Feb 9, 2009 at 8:02 AM
Edited Feb 9, 2009 at 10:56 AM
Hi Infragistics team,

first I want to thank you for ncal!.

My Question is,
how can I handle the following event?
The user clicks the DocumentClose
Button(x) in the upper right corner of the document.

http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/xamDockManager_About_Styling.html

Ok, I can  put a custom button inside the doc
and use  a CloseCommand(DelegateCommand) for closing the doc like below.
But I think, using the already existing DocumentClosButton instead of
adding an additional one would be better.

Greetings
Hannes

<Button   AutomationProperties.AutomationId="Close"

          Content="exit"

          CommandParameter="{Binding RelativeSource={
          RelativeSource FindAncestor,AncestorType={x:Type
          UserControl}}}"

          Command="{Binding CloseCommand}">
</Button>

  #region CloseCommand

 

        public DelegateCommand<object> CloseCommand
        {
            get
            {
                if (_closeCommand == null)
                {
                    _closeCommand = new DelegateCommand<object>(
                        param => this.Close(),
                        param => this.CanClose);
                }
                return _closeCommand;
            }
        }

        void Close()
        {
            if (!this.CanClose)
            {
                MessageBox.Show("Close cannot execute if CanClose returns false");
                return;
            }
            else
                MessageBox.Show("Closing");
        }

        bool CanClose
        {
            //Always True
            get { return 1 == 1; }
        }

        #endregion //CloseCommand

Coordinator
Feb 9, 2009 at 1:39 PM
Hi,

Thanks for your feedback.  It seems your question is about XamDockManager and not directly related to NCAL, so please post the question on Infragistics' XamDockManager Forum.  That way, your question and answer will be easily discoverable by other developers. Thanks!
Feb 9, 2009 at 2:44 PM
Edited Feb 12, 2009 at 8:55 AM

Hi,

sorry, but this question it exactly right here,
because the problem is to trap the
closing event in a composite WPF application and
not within an ordinary WPF application.

Greetings
Hannes

Coordinator
Feb 11, 2009 at 8:08 PM
Sorry for the mix-up, Hannes.  Is there a virtual method you can override, or an event to hook, in your View to be notified that it is no longer in the Region?