Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Prev Previous commit
Next Next commit
Added Gauge.xaml
Added a default control and style template for the 'Gauge' control.
  • Loading branch information
ElectroAttacks authored Jan 9, 2024
commit 2ed0385f1fdd8c179ea9b55bc3433ae77368497f
64 changes: 64 additions & 0 deletions 64 src/Wpf.Ui/Controls/Gauge/Gauge.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls">

<ControlTemplate x:Key="DefaultGaugeTemplate" TargetType="{x:Type controls:Gauge}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>

<ContentPresenter Content="{TemplateBinding Header}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"
Visibility="Visible"
Grid.Column="1"
Grid.Row="1"/>

<ContentPresenter Content="{TemplateBinding Content}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"
Visibility="Visible"
Grid.Column="1"
Grid.Row="2"/>
</Grid>
</ControlTemplate>

<Style x:Key="DefaultGaugeStyle" TargetType="{x:Type controls:Gauge}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Indicator" Value="{DynamicResource SystemAccentColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />

<Setter Property="Focusable" Value="False" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template" Value="{StaticResource DefaultGaugeTemplate}" />

<Setter Property="Padding" Value="0,0,0,2.5" />
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}" />

<Setter Property="Content" Value="{Binding RelativeSource={RelativeSource Self}, Path=Value}" />
</Style>

<Style BasedOn="{StaticResource DefaultGaugeStyle}" TargetType="{x:Type controls:Gauge}" />

</ResourceDictionary>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.