Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window animation interferes with WindowsFormsHost positioning #1835

Closed
barbeque opened this issue Mar 11, 2015 · 2 comments
Closed

Window animation interferes with WindowsFormsHost positioning #1835

barbeque opened this issue Mar 11, 2015 · 2 comments

Comments

@barbeque
Copy link

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.

@kjeremy
Copy link

kjeremy commented Jan 29, 2016

I see this too on Windows 7

petvetbr added a commit to petvetbr/MahApps.Metro that referenced this issue Mar 2, 2016
@punker76 punker76 added this to the 1.5.0 milestone Apr 3, 2017
@punker76
Copy link
Member

punker76 commented Apr 3, 2017

@barbeque I added a TransitionCompleted event to MetroContentControl and WindowTransitionCompleted event to MetroWindow which will be fired after the loaded Storyboard is completed. So you can subscribe to this event and can fire InvalidateVisual() (@petvetbr suggested this in #2394). This will be available in 1.5.0.
/cc @kjeremy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants