簡體   English   中英

棱鏡 7.2 中的模態對話框

[英]modal dialog in prism 7.2

我正在開發一個 .net core 3 wpf Prism 應用程序,我想知道如何使用 Prism 7.2 中的新 IDIalogAware 界面在模式對話框顯示時使主窗口變灰。 我在 Prism xamarin.forms 中尋找類似屬性 DialogLayout.MaskStyle 的東西?

在主窗口的最頂部放置一個“霧”控件,默認情況下隱藏。 將其可見性綁定到殼視圖模型上的屬性。 創建此屬性重定向到的服務。 也將服務注入到模態對話框的視圖模型中。 用它來激活從霧OnDialogOpened和停用OnDialogClosed

編輯:“重定向”部分的一些示例代碼...

public interface IFogController : INotifyPropertyChanged
{
    bool IsFogVisible { get; set; }
}

internal class ShellViewModel : BindableBase
{
    public ShellViewModel( IFogController fogController )
    {
        _fogController = fogController;
        PropertyChangedEventManager.AddHandler( fogController, ( sender, args ) => RaisePropertyChanged( nameof(IsFogVisible) ), nameof( IFogController.IsFogVisible ) );
    }

    public bool IsFogVisible
    {
        get => _fogController.IsFogVisible;
        set => _fogController.IsFogVisible = value;
    }

    private readonly IFogController _fogController;
}

internal class FogController : BindableBase, IFogController
{
    public bool IsFogVisible
    {
        get => _isFogVisible;
        set => SetProperty( ref _isFogVisible, value );
    }

    private bool _isFogVisible;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM