Mahapps.metro: metrowindow topmost property binding issue

Created on 13 Feb 2020  路  7Comments  路  Source: MahApps/MahApps.Metro

I am using MahApps for my WPF application and when the metro window is used, the TopMost property is not able to bind. If i set it as a static value it works though.

<Controls:MetroWindow x:Class="SabreContractSearch.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:prism="http://prismlibrary.com/"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        prism:ViewModelLocator.AutoWireViewModel="True"
        Topmost= "{Binding Pin}" Title="{Binding Title}" Height="350" Width="525" Name="FrmMainWindow" >

Pin is a boolean property here.

If i remove the metro window and use the normal window tag for WPF, it works. Is this a bug?

Bug

All 7 comments

@sg2707 This should be working in v1.6.5 and current source. The main demo has a Binding to this property via Menu Item. So maybe you can create or upload this simple sample here on GitHub? Thx.

image

In this example it is binding the menu item to the Window property, What I am trying is to bind the viewmodel property to the window property.

Topmost= "{Binding Pin}"

Hi @sg2707
I think there should be no difference between Binding to MenuItem and ViewModel. It would be useful to have a look into your App or a sample App. I think there is an issue in the MVVM.

Happy coding,
Tim

As i mentioned in the issue, if i change the metro window to WPF window, there is no issue. same code works. Check attachment.

Press
image

ContractSearch.zip

@sg2707 I can confirm the issue with your repro.

@sg2707 I found the bug. It happens at WindowChromeBehavior from ControlzEx. The Binding will be broken by our Topmost hack. I will fix this.

@sg2707 It's fixed now and available with ControlzEx v4.2.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AzureZeng picture AzureZeng  路  3Comments

punker76 picture punker76  路  3Comments

barryBithead picture barryBithead  路  5Comments

economypowers picture economypowers  路  4Comments

BornToBeRoot picture BornToBeRoot  路  3Comments