Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Changing property IsIndeterminate on MaterialDesign button in WPF

I’m using a material design button in WPF and I’m not quite sure how to control the property IsIndeterminate from within C# code as the below does not work, like it usually does with "standard" properties like Content etc.

BTN_Search.materialDesign:ButtonProgressAssist.IsIndeterminate = true;

The WPF for the button below:

<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>

I want the materialDesign:ButtonProgressAssist.IsIndeterminate property to be changed in the Click event when the button is pressed and then once I am done processing I need to change it back to False.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It is a dependency property so it can be set like this:

ButtonProgressAssist.SetIsIndeterminate(BTN_Search, true);

There is other examples on Github in the MaterialDesignInXamlTooking project https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading