Combination with Microsoft WPF Ribbon Control

Jul 16, 2009 at 12:31 AM

Hi everyone.

I'm trying to use AvalonDock in RibbonWindow that is provided by Microsoft's ribbon control(CTP).

In that case, a following error happens...

"Layout measurement override of element 'AvalonDock.ResizingPanel' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size."

 

Anyone know how to solve this problem?

 

Thanks.
 

Jul 28, 2009 at 7:43 AM

Hi mid,

I've got the same Problem... Did you find a solution? It would be great if you could help me:)

Thank you!

Best regards,

picatshow

Jul 28, 2009 at 8:26 AM
Edited Jul 28, 2009 at 8:27 AM

Hi picatshow, I solved this problem by following code. Hope this helps you.

Regards,

mid


 [xaml]

     <DockPanel x:Name="baseDockPanel">

        <ribbon:Ribbon x:Name="ribbon" DockPanel.Dock="Top" Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}}, Path=Title}">
            (ribbon definition......)
        </ribbon:Ribbon>

        <DockPanel x:Name="dockPanel" LastChildFill="True">
            <docking:DockingManager x:Name="manager" Height="{Binding ElementName=dockPanel, Path=ActualHeight, Converter={StaticResource ValidSizeConverter}}">
                (docking window definition......)
            </docking:DockingManager>
        </DockPanel>

    </DockPanel>


 [ValidSizeConverter.cs]

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace yourNameSpace
{
    public class ValidSizeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == DependencyProperty.UnsetValue || !(value is double))
            {
                return Binding.DoNothing;
            }

            double size = (double)value;

            if (double.IsInfinity(size) || double.IsNaN(size) || double.IsNegativeInfinity(size) || double.IsPositiveInfinity(size))
            {
                return Binding.DoNothing;
            }

            return size;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return new NotImplementedException();
        }
    }
}
Jul 28, 2009 at 8:47 AM

Thank you! Thank you! Thank you, mid!

This helped perfectly:) Obviously we are working on a similar project, so if you have any problem, maybe I can help you too;)

Regards,

picatshow

Aug 27, 2009 at 12:07 PM

Hallo mid,

I have another question to it. Does this Problem appear because the DockingManager tries to get its Size during runtime depending on the Window size? I know I used your Code Snippets, but I did not really get the problem up to now...

Thanks for your patience ;),

Regards,

picatshow