Skip to content

Instantly share code, notes, and snippets.

View wtuts's full-sized avatar

Windows App Tutorials wtuts

View GitHub Profile
<controls:Gauge Width="136"
Height="136"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Maximum="100"
ScaleBrush="Blue"
ScaleWidth="20"
Style="{StaticResource Gauge}"
<Page.Resources>
<Style x:Key="Gauge" TargetType="controls:Gauge">
<Setter Property="FontFamily" Value="Segoe WP" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Gauge">
<Viewbox>
<Grid x:Name="Container"
Width="200"
xmlns:controls="using:Gauge.Controls"
/// <summary>
/// A Modern UI Radial Gauge.
/// </summary>
[TemplatePart(Name = NeedlePartName, Type = typeof(Path))]
[TemplatePart(Name = ScalePartName, Type = typeof(Path))]
[TemplatePart(Name = TrailPartName, Type = typeof(Path))]
[TemplatePart(Name = ValueTextPartName, Type = typeof(TextBlock))]
public class Gauge : Control
{
#region Constants
<StackPanel Background="{StaticResource ThemeColor}" Height="60" HorizontalAlignment="Center">
<TextBlock Text="Hello World" Style="{StaticResource MyTextBlockStyle}"/>
</StackPanel>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/SharedResources.xaml" />
<ResourceDictionary Source="Themes/PlatformSpecificThemes.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Style x:Key="MyTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Green"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Margin" Value="12"/>
</Style>
<Style x:Key="MyTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Margin" Value="12"/>
</Style>
<TextBlock Text="Hello World!!" Style="{StaticResource MyTextBlockStyle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
ToastService.ShowToastNotification(MyTextBox.Text);
}