Ticket T333543
Visible to All Users

How to size FloatPanel with XtraGrid located inside the WindowsFormsHost control

created 9 years ago (modified 9 years ago)

[DevExpress Support Team: CLONED FROM T316264: FloatGroup.SizeToContent doesn't work when WindowsFormsHost is used as the root content]
Could you please try docking to the right hand side of Benchmark grid (as in the screenshot), then check/uncheck the +3's?
Thanks,
Thomas

Answers approved by DevExpress Support

created 9 years ago

Hello,
To resolve this issue, I suggest you perform your sizing logic only when your LayoutPanel is floating. For example, you can create an additional bool property and use it as a flag in the OnDocked event handler. I've modified your sample project to demonstrate the main idea of this approach.

Thanks,
Kirill

    Show previous comments (16)
    Andrey Marten (DevExpress Support) 9 years ago

      Thomas, you can enable and disable the AutoWidth option depending on the current panel's state. What do you think?
      Andrey

        I'm not sure I follow that. Can you please post a sample or modify the spike attached?

        Thanks,
        -Thomas

        DevExpress Support Team 9 years ago

          Hi Thomas,
          The simplest way to do so is to bind the FloatGroup.SizeToContent to DockItemState using a custom converter in the LayoutPanel style.

          XAML
          <Style TargetType="{x:Type dxdo:LayoutPanel}"> ... <Setter Property="dxdo:FloatGroup.SizeToContent" Value="{Binding DockItemState, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={dxDockingSpike:StateToSizeToContentConverter}}" /> </Style>
          C#
          public class StateToSizeToContentConverter : MarkupExtension, IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var state = (DockItemState)value; switch (state) { case DockItemState.Floating: return SizeToContent.WidthAndHeight; case DockItemState.Docked: return SizeToContent.Manual; } return value; } public override object ProvideValue(IServiceProvider serviceProvider) { return this; } ... }

          I've attached a modified sample.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.