Introduction
I am going to show you how you can get the status if the battery is charged, discharged and the specific amount of percentage. It will show you how you can help users with just a few lines of code and ensure that you respect their device’s battery life. It is also useful to notify the battery status before your app performs any battery intensive operation performed by asking plug-in charge when the battery is low and no power supplied.
Create a new Windows 10 project and design using the following XAML code,
Let’s start
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <Grid.RowDefinitions>
- <RowDefinition Height="*"></RowDefinition>
- <RowDefinition Height="*"></RowDefinition>
- </Grid.RowDefinitions>
- <TextBlock x:Name="batteryStatusbox" HorizontalAlignment="Center" Grid.Row="0" VerticalAlignment="Center">
- </TextBlock>
- <ProgressBar x:Name="statusinPer" HorizontalAlignment="Center" Height="40" Grid.Row="1" VerticalAlignment="Top" Width="360" SmallChange="0.1" />
- </Grid>



Aditya GoudPosted May 4, 2017, 8:48 AM
This Works ! But only when the battery percentage is changed. Until the event docent get fired!
Harshad PansuriyaPosted Dec 12, 2015, 12:55 AM
Nice one