Floating window maximalization

Jan 17, 2011 at 9:22 AM

Hello,

We're using AvalonDock in one of our projects and we've found that AD does not provide the functionality to maximize a floating document window. Not sure if this was implemented before so here goes :

We've modified DocumentFloatingWindow.cs as shown below. It works with the default template and the dev2010 template as well, if you like - feel free to use it.
The floating document window will maximize when you click on the window's header bar (a WPF border, named differently depending on the template). 
The window will restore it's size and position when double clicked-on again. 

public class DocumentFloatingWindow : FloatingWindow 
{
/* (...) */
Rect rsBounds;

internal DocumentFloatingWindow(DockingManager manager) : base(manager)
{
this.Loaded += new RoutedEventHandler(DocumentFloatingWindow_Loaded);
}

void DocumentFloatingWindow_Loaded(object sender, RoutedEventArgs e)
{
// default theme
DependencyObject border = GetTemplateChild("PART_HighlightBorder");

if(border is Border)
{
(border as Border).PreviewMouseDown += new MouseButtonEventHandler(DocumentFloatingWindow_PreviewMouseDown);
}

// dev2010 theme
border = GetTemplateChild("PART_MoveAnchor");

if(border is Border)
{
(border as Border).PreviewMouseDown += new MouseButtonEventHandler(DocumentFloatingWindow_PreviewMouseDown);
}

void DocumentFloatingWindow_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
// double-click event
if(e.ClickCount > 1)
{
if(WindowState == System.Windows.WindowState.Normal)
{
rsBounds = new Rect(RestoreBounds.X, RestoreBounds.Y, RestoreBounds.Width, RestoreBounds.Height);
WindowState = System.Windows.WindowState.Maximized;
}
else if(WindowState == SystemWindows.WindowState.Maximized)
{
WindowState = System.Windows.WindowState.Normal;
Left = rsBounds.X;
Top = rsBounds.Y;
Width = rsBounds.Width;
Height = rsBounds.Height;
}

e.Handled = true;
}
}

}

}

 

In addition we've got a set of translations for AvalonDock for the following languages in an *xls file, which we'd like to submit:

  • Chineese
  • French
  • Polish
  • Russian
  • Spanish

Please let me know how we can deliver those and will be most happy to do so.

Best regards