-
-
Notifications
You must be signed in to change notification settings - Fork 161
/
MainWindow.xaml
64 lines (54 loc) · 2.69 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<Window x:Class="IconPacksValueConverterSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:IconPacksValueConverterSample"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="525"
Height="350"
mc:Ignorable="d">
<Grid>
<Grid.Resources>
<local:BatteryValueConverter x:Key="BatteryValueConverter" />
<local:BatteryQuarterValueConverter x:Key="BatteryQuarterValueConverter" />
</Grid.Resources>
<StackPanel Margin="20"
VerticalAlignment="Center"
Orientation="Vertical">
<Slider x:Name="ValueSlider"
Margin="0 5"
LargeChange="5"
Maximum="100"
Minimum="0"
SmallChange="1" />
<TextBlock Margin="0 5"
HorizontalAlignment="Center"
FontSize="48"
Text="{Binding ElementName=ValueSlider, Path=Value, StringFormat={}{0:000.00}}" />
<StackPanel HorizontalAlignment="Center">
<CheckBox x:Name="ChargingCheckBox"
Content="Charging" />
</StackPanel>
<iconPacks:PackIconMaterial Width="56"
Height="56"
Margin="0 5"
HorizontalAlignment="Center">
<iconPacks:PackIconMaterial.Kind>
<MultiBinding Converter="{StaticResource BatteryValueConverter}">
<MultiBinding.Bindings>
<Binding ElementName="ValueSlider" Path="Value" />
<Binding ElementName="ChargingCheckBox" Path="IsChecked" />
</MultiBinding.Bindings>
</MultiBinding>
</iconPacks:PackIconMaterial.Kind>
</iconPacks:PackIconMaterial>
<iconPacks:PackIconFontAwesome Width="56"
Height="56"
Margin="0 5"
HorizontalAlignment="Center"
Kind="{Binding ElementName=ValueSlider, Path=Value, Converter={StaticResource BatteryQuarterValueConverter}}" />
</StackPanel>
</Grid>
</Window>