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

First 30 units of flyout aren't clickable #2288

Closed
Anapher opened this issue Jan 3, 2016 · 4 comments
Closed

First 30 units of flyout aren't clickable #2288

Anapher opened this issue Jan 3, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@Anapher
Copy link
Contributor

Anapher commented Jan 3, 2016

Hey,
I just updated to the new MahApps.Metro version and noticed the the first 30 units of a flyout aren't clickable because there lays an invisible grid.
FlyoutNotClickable
(As you can see on the picture, even if the mouse is directly over the button, the hover style doesn't get applied)

First, I was sure that it was my fault and I forgot to hide a grid, so I wrote some code which shows the element directly under the cursor in the title bar.
Small Video

Here is the code to display the current element in the title bar (you can also set a break point to analyze the element):

        private void MainWindow_OnMouseMove(object sender, MouseEventArgs e)
        {
            var element = Mouse.DirectlyOver as UIElement;
            Title = element?.ToString() ?? "";
        }

I will also take a look at the mahapps code but I thought that it would be the best if I create an issue first, perhaps somebody knows where the grid comes from.

@Anapher
Copy link
Contributor Author

Anapher commented Jan 3, 2016

Okay, I figured out that this part in flyout.xaml causes the problem:

            <Thumb Style="{StaticResource WindowTitleThumbStyle}"
                   Height="{Binding Path=TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}"
                   VerticalAlignment="Top"
                   x:Name="PART_WindowTitleThumb" />

If I set the title bar height to 0, everything is awesome. I think that you've missed in the implementation that you can adjust the flyout height and that it doesn't have to overlay the title bar. I have no idea how I could solve this problem because I don't know why you need that.

@N0ct3
Copy link

N0ct3 commented Jan 12, 2016

Same issue here.
I have to get this part by name and set its template to null to potentially make the whole flyout surface clickable.

@punker76 punker76 added the Bug label Jan 21, 2016
@punker76 punker76 added this to the 1.2.4 milestone Jan 21, 2016
@punker76 punker76 self-assigned this Jan 21, 2016
@PavelLvou
Copy link

I have the same proble in version 1.2.4 and in alpha 1.3.0

Here my xaml code

<controls:MetroWindow ShowCloseButton="False" WindowStyle="None" TitlebarHeight="100"
        ResizeMode="NoResize" Height="630" Width="450">
    <controls:MetroWindow.TitleTemplate>
        <DataTemplate>
            <Border x:Name="RootBorder">
                <Grid Background="Transparent">
                    <Button Name="SomeButton" Command="{Binding Path=ClickButtonCommand}">
                        <TextBox Text="Button in title"></TextBox>
                    </Button>
                </Grid>
            </Border>
        </DataTemplate>
    </controls:MetroWindow.TitleTemplate>
    <Border>
        <Button Name="SomeButton" Command="{Binding Path=ClickButtonCommand}">
            <TextBox Text="Button in body"></TextBox>
        </Button>
    </Border>
</controls:MetroWindow>

and relust

part_windowtitlethumb

Button in title aren't clickable, because there lays an invisible grid

@punker76
Copy link
Member

@PavelLvou You should use LeftWindowCommands or RightWindowCommands for button stuff

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

No branches or pull requests

4 participants