Skip to content

Instantly share code, notes, and snippets.

@0x414c49
Created January 20, 2020 15:06
Show Gist options
  • Save 0x414c49/93f1ad66b3129ca0ff74297f36a0ec55 to your computer and use it in GitHub Desktop.
Save 0x414c49/93f1ad66b3129ca0ff74297f36a0ec55 to your computer and use it in GitHub Desktop.
Battery component
<StackLayout Orientation="StackOrientation.Horizontal"
HorizontalOptions="LayoutOptions.Center">
<Label Text="@("Battery level is " + BatteryLevel.ToString())"
FontAttributes="FontAttributes.Bold"
VerticalTextAlignment="TextAlignment.Center" />
</StackLayout>
@code
{
double BatteryLevel
{
get => Xamarin.Essentials.Battery.ChargeLevel;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment