如何单向绑定到 materialDesign:ButtonProgressAssist.IsIndicatorVisible DependencyProperty

How to OneWayBind to materialDesign:ButtonProgressAssist.IsIndicatorVisible DependencyProperty

我有一个登录按钮,我想在登录过程中应用不确定的进度查看。

这是按钮的 XAML:

<Button x:Name="LoginButton" Style="{StaticResource MaterialDesignRaisedButton}" 
        materialDesign:ButtonProgressAssist.Value="-1"
        materialDesign:ButtonProgressAssist.IsIndicatorVisible="false"
        materialDesign:ButtonProgressAssist.IsIndeterminate="true">
    LOGIN
</Button>

所以我认为我可以将视图模型上的布尔值 属性 绑定到 materialDesign:ButtonProgressAssist.IsIndicatorVisible。我正在像这样使用绑定背后的代码:

public partial class Connection : ReactiveUserControl<ConnectionViewModel>
{
    public Connection()
    {
        InitializeComponent();
        ViewModel = ViewModelLocator.ConnectionViewModel;

        this.WhenActivated(d =>
        {
            this.BindCommand(ViewModel, vm => vm.LoginCommand, v => v.LoginButton).DisposeWith(d);
            // How do I bind to this property using OneWayBind?
            this.OneWayBind(ViewModel, vm => vm.LoggingIn, v => v.LoginButton.ButtonProgressAssist.IsIndicatorVisible).DisposeWith(d);
        });
    }
}

Intellisense 不接受 material 设计依赖性 属性。如何引用它?

以防万一,WPF 项目以 .NET Core 3.1 为目标

我认为 OneWayBind 方法不支持附加属性,但您可以在 XAML 标记中绑定到它:

materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding LoggingIn, Mode=OneWay}"

您当然可以像以前一样对其他属性进行 OneWayBind