XamDockManager- handling closing Document event triggerd by DocumentCloseButton

Feb 9, 2009 at 9:02 AM
Edited Feb 9, 2009 at 11: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.


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.


<Button   AutomationProperties.AutomationId="Close"


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

          Command="{Binding CloseCommand}">

  #region CloseCommand


        public DelegateCommand<object> CloseCommand
                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");

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

        #endregion //CloseCommand

Feb 9, 2009 at 2:39 PM

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 3:44 PM
Edited Feb 12, 2009 at 9:55 AM


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.


Feb 11, 2009 at 9: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?