有没有办法在 Prism 的代码中使用动态调整对话框的大小IDialogService
?我想根据用户的屏幕分辨率调整对话框的大小。
这是我打开对话框的方式:
public class MainViewModel
{
// Gets injected in the constructor
private IDialogService dialogService;
private void OpenDialog()
{
this.dialogService.ShowDialog(
nameof(MyDialog),
new DialogParameters(),
result => { });
}
}
这是我的对话框在 XAML 中的样子
<UserControl
x:Class="MyApplication.MyDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<!-- various controls -->
</UserControl>