I've built a dialog window that i plan to use in my whole application instead of using a message box. Whenever i need to use it, i would call it in the code behind of my Window i'm currently working with this syntax:
public void ShowDialogWindow(object sender, DialogEventArgs e)
{
DialogWindow dialog = new DialogWindow(e.MessageToShow, DialogType.Error, ButtonsType.OkOnly, this.ActualWidth, this.ActualHeight, this);
dialog.ShowDialog();
}
this is the constructor of my Dialog Window
public DialogWindow(string messageToDisplay, DialogType dialog, ButtonsType buttons, double width, double height, object Owner)
{
InitializeComponent();
this.DataContext = this;
this.Owner = Owner as Window;
AWidth = width;
AHeight = height;
-----
}
and this is the opening Window tag in the xaml
<Window x:Class="DialogWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
---
mc:Ignorable="d" WindowStyle="None"
WindowStartupLocation="CenterOwner"
AllowsTransparency="True"
Width="{Binding AWidth}" Height="{Binding AHeight}"
MinHeight="720" MinWidth="1080">
Now my problem is. When i call this dialog when the owner is Minimized (having set MinWidth = 1080 and MinHeght = 720) the dialog "kinda" fits (ActualWidth and Actual Height of both Window and DialogWindow are the same, but visually the DialogWindow seems a little bit bigger than the Owner)
But when i go full screen it happens this:
Not only the ActualHeight is different to the property AHeight (which is set correctly to the ActualHeight of the Owner), but also is not centered on the Owner window at all, but overflow on my second screen. What cause this, and how can i solve it?