Search code examples
silverlightbusyindicator

How to get the value of the progressBar of a busyIndicator in Silverlight?


I would like to know how can I get the percentage value of a progress bar of a BusyIndiccator in silverlight? I am new in using this control. I hope I can get the answer to my question. Thanks!


Solution

  • BusyIndicator doesn't have a progressValue, it is just a visual element to show that something is happening. However you can check the samples on how to change this :

     <controlsToolkit:HeaderedContentControl
                    Grid.Column="2"
                    Header="Custom Content"
                    Style="{StaticResource SampleContainer}">
                    <controlsToolkit:BusyIndicator
                        IsBusy="True"
                        DisplayAfter="0">
                        <controlsToolkit:BusyIndicator.BusyContentTemplate>
                            <DataTemplate>
                                <StackPanel Margin="4" >
                                    <TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/>
                                    <StackPanel Margin="4">
                                        <TextBlock Text="Downloading message 4/10..."/>
                                        <ProgressBar Value="40" Height="15"/>
                                    </StackPanel>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0"/>
                                        <Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0"/>
                                    </Grid>
                                </StackPanel>
                            </DataTemplate>
                        </controlsToolkit:BusyIndicator.BusyContentTemplate>
                        <controlsToolkit:BusyIndicator.OverlayStyle>
                            <Style TargetType="Rectangle">
                                <Setter Property="Fill" Value="#ffffeeee"/>
                            </Style>
                        </controlsToolkit:BusyIndicator.OverlayStyle>
                        <controlsToolkit:BusyIndicator.ProgressBarStyle>
                            <Style TargetType="ProgressBar">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </Style>
                        </controlsToolkit:BusyIndicator.ProgressBarStyle>
                        <ContentControl Style="{StaticResource SampleContent}"/>
                    </controlsToolkit:BusyIndicator>
                </controlsToolkit:HeaderedContentControl>
    

    Link : Silverlight samples