我在WPF中使用一个材料设计按钮,我不太确定如何从c#代码中控制属性IsIndeterminate,因为下面的代码不起作用,就像它通常使用'标准';内容等属性
BTN_Search.materialDesign:ButtonProgressAssist.IsIndeterminate = true;
下面按钮的WPF:
<Grid Width="124" Margin="5" VerticalAlignment="Center">
<Button Style="{StaticResource MaterialDesignRaisedButton}"
materialDesign:ButtonProgressAssist.Value="-1"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="True"
materialDesign:ButtonProgressAssist.IsIndeterminate="False"
Content="Search"
Margin="2,0"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
x:Name="BTN_Search"
Click="Search_Click"/>
</Grid>
我想要materialDesign:ButtonProgressAssist。当按钮被按下时,IsIndeterminate属性将在Click事件中更改,然后一旦我完成处理,我需要将其更改回False。
它是一个依赖属性,所以可以这样设置:
ButtonProgressAssist.SetIsIndeterminate(BTN_Search, true);
还有其他的例子在Github上的materialdesigninxamltlooking项目https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs