Skip to content

Commit 452ff0b

Browse files
Colin MackayColin Mackay
authored andcommitted
Add Slider
1 parent 97ca411 commit 452ff0b

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

src/Stravaig.Avalonia.Controls.Icons/PhosphorIcon/PhosphorIconType.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ namespace Stravaig.Avalonia.Controls.Icons;
22

33
public enum PhosphorIconType
44
{
5-
Light = 1,
6-
Thin = 2,
5+
Thin = 1,
6+
Light = 2,
77
Regular = 3,
88
Bold = 4,
99
Fill = 5,
1010
Duotone = 6,
11-
}
11+
}

src/Stravaig.Icons.Example/ViewModels/PhosphorIconDemoViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public partial class PhosphorIconDemoViewModel : ViewModelBase
1919
[ObservableProperty]
2020
private PhosphorIconType _selectedIconType;
2121

22+
[ObservableProperty]
23+
private int _iconSize;
24+
2225
partial void OnSelectedIconTypeIndexChanged(int? value)
2326
{
2427
if (value.HasValue)
@@ -32,6 +35,7 @@ public PhosphorIconDemoViewModel()
3235
_isExpanded = Design.IsDesignMode;
3336
_selectedIconTypeIndex = 0;
3437
_selectedIconType = IconTypes[0].Key;
38+
_iconSize = 24;
3539
}
3640

3741
public List<KeyValuePair<PhosphorIconName, string>> Icons { get; } = Enum.GetValues<PhosphorIconName>().Select(n => new KeyValuePair<PhosphorIconName, string>(n, n.ToString())).ToList();

src/Stravaig.Icons.Example/Views/PhosphorIconDemoView.axaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@
5050
</ComboBox>
5151
</StackPanel>
5252

53+
<StackPanel Orientation="Horizontal">
54+
<TextBlock
55+
Margin="5"
56+
Classes="H2"
57+
VerticalAlignment="Center"
58+
Text="Size:"/>
59+
<Slider
60+
HorizontalAlignment="Stretch"
61+
Minimum="8"
62+
Maximum="256"
63+
MinWidth="256"
64+
Value="{Binding IconSize}"/>
65+
<TextBlock
66+
Margin="5"
67+
Text="{Binding IconSize}"
68+
VerticalAlignment="Center"/>
69+
</StackPanel>
70+
5371
<ItemsControl Name="IconsItemsControl" ItemsSource="{Binding Icons}">
5472
<ItemsControl.ItemsPanel>
5573
<ItemsPanelTemplate>
@@ -69,8 +87,8 @@
6987
<icons:PhosphorIcon
7088
IconName="{Binding Key}"
7189
IconType="{Binding #PhosphorIconDemo.((vm:PhosphorIconDemoViewModel)DataContext).SelectedIconType, FallbackValue={x:Static icons:PhosphorIconType.Regular}}"
72-
Width="24"
73-
Height="24"/>
90+
Width="{Binding #PhosphorIconDemo.((vm:PhosphorIconDemoViewModel)DataContext).IconSize, FallbackValue=24}"
91+
Height="{Binding #PhosphorIconDemo.((vm:PhosphorIconDemoViewModel)DataContext).IconSize, FallbackValue=24}"/>
7492
<TextBlock
7593
HorizontalAlignment="Center"
7694
Text="{Binding Value}"/>

0 commit comments

Comments
 (0)