Posted 16 years ago by Michael Smit
Version: 4.5.0477
Avatar
Hi,

I am playing around with the trial of your product and have come unstuck with the MDI docking.

Here is my xaml..

<Page x:Class="FMS.Main"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon" 
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
    Title="Franchise Management System" Width="1024" Loaded="Page_Loaded" xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking">
  <DockPanel LastChildFill="True">
    <ribbon:Ribbon Height="Auto" Name="ribbon1" Width="1024" DockPanel.Dock="Top">
      <ribbon:Ribbon.ApplicationMenu>
        <ribbon:ApplicationMenu>
          <ribbon:ApplicationMenu.FooterButtons>
            <ribbon:Button Label="Exit" />
          </ribbon:ApplicationMenu.FooterButtons>
          <ribbon:ApplicationMenu.AdditionalContent>
            <ribbon:RecentDocumentMenu>
              <ribbon:RecentDocumentMenu.Manager>
                <shared:RecentDocumentManager />
              </ribbon:RecentDocumentMenu.Manager>
            </ribbon:RecentDocumentMenu>
          </ribbon:ApplicationMenu.AdditionalContent>
          <ribbon:Button Label="Menu Item" />
        </ribbon:ApplicationMenu>
      </ribbon:Ribbon.ApplicationMenu>
      <ribbon:Tab Label="Maintenance">
        <ribbon:Group Label="Accounts" Width="Auto">
          <ribbon:Button ImageSourceSmall="pack://application:,,,/ActiproSoftware.Ribbon.Wpf30;component/Products/Ribbon/Images/ButtonDefault32.png" Label="New" Name="NewAccountButton" Click="NewAccountButton_Click" />
          <ribbon:Button ImageSourceSmall="pack://application:,,,/ActiproSoftware.Ribbon.Wpf30;component/Products/Ribbon/Images/ButtonDefault32.png" Label="List" Name="ListAccountsButton" Click="ListAccountsButton_Click" />
        </ribbon:Group>
      </ribbon:Tab>
    </ribbon:Ribbon>
        
    <docking:DockSite Height="Auto" Name="MainDockSite" Width="Auto" AreDocumentWindowsDestroyedOnClose="False">
      <docking:SplitContainer>
        <docking:Workspace>
          <docking:TabbedMdiHost>
            <docking:TabbedMdiContainer Name="mdiContainer"></docking:TabbedMdiContainer>
          </docking:TabbedMdiHost>
        </docking:Workspace>
      </docking:SplitContainer>      
    </docking:DockSite>      
  </DockPanel>
</Page>
I then add DocumentWindow objects in code...

private void ListAccountsButton_Click(object sender, ActiproSoftware.Windows.Controls.Ribbon.Controls.ExecuteRoutedEventArgs e)
{
  DocumentWindow dw = new DocumentWindow(MainDockSite);
  dw.Title = mdiContainer.Items.Count.ToString() + " : Items";
  dw.Activate();   
}
Everything works 100% until I drag a the last DocumentWindow from one container to a new one. The application then crashes with
"Object reference not set to an instance of an object".

I have tried to clone your samples as much as possible, but still no go.

Please give me an idea as to what I am doing wrong.

Comments (5)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

I think if you remove the TabbedMdiContainer in your XAML, it will work fine. You should never put in an empty TabbedMdiContainer in the XAML. The only time you include those in XAML is if they have at least one child docking window in them. They are created on demand by us and having an empty one will throw things off.

Let us know if that helps. Also for your document title, you can use properties off of DockSite to know how many documents are open, etc.


Actipro Software Support

Posted 16 years ago by Michael Smit
Avatar
Sorry guys. That now working. I now have the following...

<Page x:Class="FMS.Main"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon" 
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
    Title="Franchise Management System" Width="1024" Loaded="Page_Loaded" xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking">
  <DockPanel LastChildFill="True">
    <ribbon:Ribbon Height="Auto" Name="ribbon1" Width="1024" DockPanel.Dock="Top">
      <ribbon:Ribbon.ApplicationMenu>
        <ribbon:ApplicationMenu>
          <ribbon:ApplicationMenu.FooterButtons>
            <ribbon:Button Label="Exit" />
          </ribbon:ApplicationMenu.FooterButtons>
          <ribbon:ApplicationMenu.AdditionalContent>
            <ribbon:RecentDocumentMenu>
              <ribbon:RecentDocumentMenu.Manager>
                <shared:RecentDocumentManager />
              </ribbon:RecentDocumentMenu.Manager>
            </ribbon:RecentDocumentMenu>
          </ribbon:ApplicationMenu.AdditionalContent>
          <ribbon:Button Label="Menu Item" />
        </ribbon:ApplicationMenu>
      </ribbon:Ribbon.ApplicationMenu>
      <ribbon:Tab Label="Maintenance">
        <ribbon:Group Label="Accounts" Width="Auto">
          <ribbon:Button ImageSourceSmall="pack://application:,,,/ActiproSoftware.Ribbon.Wpf30;component/Products/Ribbon/Images/ButtonDefault32.png" Label="New" Name="NewAccountButton" Click="NewAccountButton_Click" />
          <ribbon:Button ImageSourceSmall="pack://application:,,,/ActiproSoftware.Ribbon.Wpf30;component/Products/Ribbon/Images/ButtonDefault32.png" Label="List" Name="ListAccountsButton" Click="ListAccountsButton_Click" />
        </ribbon:Group>
      </ribbon:Tab>
    </ribbon:Ribbon>
        
    <docking:DockSite Height="Auto" Name="MainDockSite" Width="Auto" AreDocumentWindowsDestroyedOnClose="False">
      <docking:SplitContainer>
        <docking:Workspace>
          <docking:TabbedMdiHost>            
          </docking:TabbedMdiHost>
        </docking:Workspace>
      </docking:SplitContainer>      
    </docking:DockSite>      
  </DockPanel>
</Page>
And to populate...

private void ListAccountsButton_Click(object sender, ActiproSoftware.Windows.Controls.Ribbon.Controls.ExecuteRoutedEventArgs e)
    {
      DocumentWindow dw = new DocumentWindow(MainDockSite);
      dw.Content = new FMS.Windows.Maintenance.Accounts.Accounts();
      dw.Title = "Test # " + MainDockSite.DocumentWindows.Count().ToString();
      dw.Activate();   
    }
I need at least

<docking:TabbedMdiHost>            
          </docking:TabbedMdiHost>
otherwise I cannot even add a new DocumentWindow. I am still however having the same problem though that when I move the last DocumentWindow from a docksite back to the original docksite, I get the "Object reference is not set to a reference of an object".

What I am doing, is firing the app up, clicking the button to generate 4 or so DocumentWindows, then dragging one to a new docksite (on the right). When I drag it back to the original docksite, bang. I would expect the newly created docksite to simply close up when the last DocumentWindow is dragged to a new location.

Any more ideas?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Correct, you do need an MDI host (like TabbedMdiHost) so it knows what type of MDI you have if any. I was saying before that you shouldn't add empty TabbedMdiContainers within that host.

Maybe you could email over a small sample project that shows this happening so we can look at what the problem is.


Actipro Software Support

Posted 16 years ago by Michael Smit
Avatar
Okay... Sample project emailed. If possible, can you attach it to this thread so other may perhaps benefit from our discussion?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the sample, this appears to be a bug that we fixed for another customer already and will be in the next maintenance release.


Actipro Software Support

The latest build of this product (v24.1.2) was released 14 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.