Posted 16 years ago
by dean
I am trying to get a documentwindow to be opened in a multi window container when i click a button.
When i click the button nothing happens even though i can step through the ScreenButton_Click method.
I have implemented this correctly?
When i click the button nothing happens even though i can step through the ScreenButton_Click method.
I have implemented this correctly?
StandardMdiHost MyMDIHost;
DockSite MyDockSite;
public override void BeginInit()
{
base.BeginInit();
//Create the docking panel
MyDockSite = CreateApplicationDockSite();
//Create the WPF docking panel that will be the content of the WPF window.
DockPanel MyDockPanel = new DockPanel();
MyDockPanel.LastChildFill = true;
//Add the docksite and the ribbon.
//Note: The Actipro Ribbon has to be the last added. Not sure why - their documentation does not
// state why...
MyDockPanel.Children.Add(MyDockSite);
this.ApplicationName = ApplicationInformation.ApplicationTitle;
this.DocumentName = string.Empty;
this.Content = MyDockPanel;
}
private DockSite CreateApplicationDockSite()
{
MyDockSite = new DockSite();
MyDockSite.Name = "MyDockSite";
MyDockSite.CanDocumentWindowsClose = false;
SplitContainer MySplitContainer = new SplitContainer();
//StandardMdiHost
MyMDIHost = new StandardMdiHost();
MyMDIHost.Name = "MyMDIHost";
MySplitContainer.Children.Add(MyMDIHost);
MyDockSite.Content = MySplitContainer;
return MyDockSite;
}
void ScreenButton_Click(object sender, ExecuteRoutedEventArgs e)
{
try
{
DocumentWindow x = new DocumentWindow(MyDockSite);
x.Activate();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}