We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Mdi document state changed event

What is the name of the event to trigger in XAML when I Maximize, Minimize or Restore a MDI document inside a DockingManager?  

  <i:Interaction.Triggers>
        <i:EventTrigger EventName="StateChanged"> <!-- This doesn't work!-->
            <i:InvokeCommandAction Command="{Binding WindowStateCahangedCommand}"/>
        </intr:EventTrigger>       
    </i:Interaction.Triggers>

3 Replies

DR Durga Rajan Syncfusion Team March 22, 2017 05:32 PM UTC

Hi Giovanni,

Thank you for contacting Sycfusion support.

We have checked your query and prepared sample to meet your requirement. In this sample we have used Build-in "DockingManagerIsInMDIMaximizedStateChangedCommand" command of DockingManager. We can address only maximize and restoring state of the MDI windows. Please download the sample from the following location.

Sample: DockingManager_StateNotify

If we have misunderstood your query, please provide more details about your requirement. This would help us to provide the solution at the earliest.

Regards,
Durga S.


GS Giovanni Selvatico March 23, 2017 02:53 PM UTC

Thank you for your reply.
Sorry, I may not have been clear enough.
I'm working in a MVVM pattern.
I have a syncfusion DocumentContainer with the ItemSource property  binded in the ViewModel to an  ObservableCollection<UserControl> that I called MyMdiDocuments.
My MDI children are of type UserControl that I load at runtime adding them at MyMdiDocuments ObservableCollection.

The file header of these MDI children is like this:

<UserControl x:Class="HI_Mdi.UserControls.MyMDIForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:HI_Mdi.UserControls"
             xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
             xmlns:intr="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
             xmlns:localvm="clr-namespace:HI_Mdi.ViewModel"   
             mc:Ignorable="d"
             syncfusion:DocumentContainer.Header="MyMDIForm"
             syncfusion:DocumentContainer.MDIBounds="10,10,450,280"            
             xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
             Height="auto" Width="auto" d:DesignWidth="600" d:DesignHeight="300" >

I would like to set a trigger to the "state changed" of the MDI documents.
Something like:
    <intr:Interaction.Triggers>
        <intr:EventTrigger EventName="StateChangedOrWhateverElseEventName"> 
          <intr:InvokeCommandAction Command="{Binding MyStateChangedCommand}"  />
        </intr:EventTrigger>
    </intr:Interaction.Triggers>

Is it possible?



DR Durga Rajan Syncfusion Team March 24, 2017 03:14 PM UTC

Hi Giovanni,

Thank you for the update.

Currently we do not have any routed event to notify the state change of MDI windows. But we can achieve this using behaviour of interaction instead of using triggers. We have prepared sample based on your requirement please download the sample from the following location.

Sample: DockingManager_DocumentContainer_Sample

Regards,
Durga S.

Loader.
Up arrow icon