Skip to content

Window animation interferes with WindowsFormsHost positioning #1835

@barbeque

Description

@barbeque

When you put a WindowsFormsHost inside a Metro window, sometimes the WinForms control will occasionally 'hang' in space after the introductory animation has completed and only move once an event (such as hovering over the 'close' box or tabbing out of the MaskedTextBox) has been processed.

image

The actual control in question doesn't seem to matter; I've experienced it with Button, MaskedTextBox and CheckedListBox off the top of my head. It also happens if the WindowsFormsHost is located inside of a StackPanel or even the root Content control, not just the nested GroupBox described in the example XAML.

The test XAML to produce this window is:

    <metro:MetroWindow x:Class="MetroDemo.DemoWindow2"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
            xmlns:wfh="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
            Title="Demo window 2" Height="500" Width="400">
        <DockPanel LastChildFill="True">
            <StackPanel Orientation="Vertical" DockPanel.Dock="Bottom">
                <GroupBox Header="WinForms Controls">
                    <StackPanel Orientation="Vertical">
                        <WindowsFormsHost Width="100" HorizontalAlignment="Left">
                            <wfh:MaskedTextBox Mask="00/000/0000"/>
                        </WindowsFormsHost>
                    </StackPanel>
                </GroupBox>
            </StackPanel>
        </DockPanel>
    </metro:MetroWindow>

I believe it is animation related because setting WindowTransitionsEnabled to false fixes the problem.

I am using v1.1.2.0, grabbed from NuGet yesterday. OS is Windows 8.1 x64.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions