Auto size ResizingPanel

Jun 10, 2008 at 8:27 PM
Is there a way to set the ResizeWidth or ResizeHeight of a ResizingPanel to be equivalent to "Auto"?  I'd like the initial size to auto-fit based on the contents, without cutting anything off.  I tried setting ResizingPanel.ResizeWidth="Auto", but this doesn't work.
Jun 11, 2008 at 7:15 AM
Sorry, at the moment ResizeWidth/height is simply a double, but your is a good idea and I just start working on it.
Nov 27, 2009 at 10:29 AM
Edited Nov 28, 2009 at 4:36 PM

I also want to autosize the panels. ad:ResizingPanel.ResizeWidth="50" does work, but unfortunately not "auto".

 

Dec 2, 2009 at 10:48 AM

I almost found a solution, dunno if it's the best way, but it works more or less.

XAML:

<ad:DockablePane Name="legendPane">
   <ad:DockableContent Name="legendWindow" Title="Legend" DockableStyle="LeftBorder" IsCloseable="False" Visibility="Hidden" FloatingResizeMode="CanResizeWithGrip">
   </ad:DockableContent>
</ad:DockablePane>

Code:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
     Grid myGrid = new Grid();
     ....
     legendWindow.Content = myGrid;
     dockManager.Show(legendWindow, DockableContentState.FloatingWindow);
     FloatingWindow fltWindow = Window.GetWindow(legendWindow) as FloatingWindow;
     fltWindow.SizeChanged += new SizeChangedEventHandler(fltWindow_SizeChanged);
     fltWindow.SizeToContent = SizeToContent.WidthAndHeight;
     fltWindow.Left = this.Left + 15;
     fltWindow.Top = this.Top + 55;
}

void fltWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
     DockableFloatingWindow window = sender as DockableFloatingWindow;
     if (window != null)
        {
           legendWindow.Width = e.NewSize.Width;
           legendWindow.Height = e.NewSize.Height;
           //legendPane.Width = e.NewSize.Width;
           //legendPane.Height = e.NewSize.Height;
           legendWindow.FloatingWindowSize = e.NewSize;
         }
}