LayoutGroup constraint issues



There is an issue with your code in the LayoutPanel:

public class LayoutPanel : LayoutPositionableGroup<ILayoutPanelElement>, ILayoutPanelElement, ILayoutOrientableGroup
|=> public abstract class LayoutPositionableGroup<T> : LayoutGroup<T>, ILayoutPositionableElement, ILayoutPositionableElementWithActualSize where T : class, ILayoutElement
|=> public abstract class LayoutGroup<T> : LayoutGroupBase, ILayoutContainer, ILayoutGroup, IXmlSerializable where T : class, ILayoutElement

Now I don't know why you added the requirement for "where T : class" because I never see it being instantiated. I am even confused how this can compile. Anyway, at runtime you get this error:

GenericArguments[0], 'Xceed.Wpf.AvalonDock.Layout.ILayoutPanelElement', on 'Xceed.Wpf.AvalonDock.Layout.LayoutGroup`1[T]' violates the constraint of type 'T'."

I think it is best to remove the where T : class (but keep the where T : ILayoutElement) because I think it is not required.


rbtLong wrote Dec 25, 2013 at 8:20 AM

im getting this problem as well . . .