|
1 |
| -using MaterialDesignThemes.Wpf; |
| 1 | +using System.Windows.Media; |
| 2 | +using MaterialDesignThemes.Wpf; |
2 | 3 |
|
3 | 4 | namespace MaterialDesignDemo.Domain;
|
4 | 5 |
|
5 | 6 | internal class SmartHintViewModel : ViewModelBase
|
6 | 7 | {
|
| 8 | + public static Point DefaultFloatingOffset { get; } = new(0, -16); |
| 9 | + public static FontFamily DefaultFontFamily = (FontFamily)new MaterialDesignFontExtension().ProvideValue(null!); |
| 10 | + |
7 | 11 | private bool _floatHint = true;
|
8 | 12 | private FloatingHintHorizontalAlignment _selectedAlignment = FloatingHintHorizontalAlignment.Inherit;
|
9 | 13 | private double _selectedFloatingScale = 0.75;
|
10 | 14 | private bool _showClearButton = true;
|
11 | 15 | private bool _showLeadingIcon = true;
|
| 16 | + private bool _showTrailingIcon = true; |
12 | 17 | private string _hintText = "Hint text";
|
13 | 18 | private string _helperText = "Helper text";
|
14 |
| - private Point _selectedFloatingOffset = new(0, -16); |
| 19 | + private Point _selectedFloatingOffset = DefaultFloatingOffset; |
15 | 20 | private bool _applyCustomPadding;
|
16 | 21 | private Thickness _selectedCustomPadding = new(5);
|
| 22 | + private double _selectedCustomHeight = double.NaN; |
| 23 | + private VerticalAlignment _selectedVerticalAlignment = VerticalAlignment.Center; |
| 24 | + private double _selectedLeadingIconSize = 20; |
| 25 | + private double _selectedTrailingIconSize = 20; |
| 26 | + private string? _prefixText; |
| 27 | + private string? _suffixText; |
| 28 | + private double _selectedFontSize = double.NaN; |
| 29 | + private FontFamily? _selectedFontFamily = DefaultFontFamily; |
17 | 30 |
|
18 | 31 | public IEnumerable<FloatingHintHorizontalAlignment> HorizontalAlignmentOptions { get; } = Enum.GetValues(typeof(FloatingHintHorizontalAlignment)).OfType<FloatingHintHorizontalAlignment>();
|
19 | 32 | public IEnumerable<double> FloatingScaleOptions { get; } = new[] {0.25, 0.5, 0.75, 1.0};
|
20 |
| - public IEnumerable<Point> FloatingOffsetOptions { get; } = new[] { new Point(0, -16), new Point(0, 16), new Point(16, 16), new Point(-16, -16) }; |
| 33 | + public IEnumerable<Point> FloatingOffsetOptions { get; } = new[] { DefaultFloatingOffset, new Point(0, -25), new Point(16, -16), new Point(-16, -16), new Point(0, -50) }; |
21 | 34 | public IEnumerable<string> ComboBoxOptions { get; } = new[] {"Option 1", "Option 2", "Option 3"};
|
22 | 35 | public IEnumerable<Thickness> CustomPaddingOptions { get; } = new [] { new Thickness(0), new Thickness(5), new Thickness(10), new Thickness(15) };
|
| 36 | + public IEnumerable<double> CustomHeightOptions { get; } = new[] { double.NaN, 50, 75, 100 }; |
| 37 | + public IEnumerable<VerticalAlignment> VerticalAlignmentOptions { get; } = (VerticalAlignment[])Enum.GetValues(typeof(VerticalAlignment)); |
| 38 | + public IEnumerable<double> IconSizeOptions { get; } = new[] { 10.0, 15, 20, 30, 50, 75 }; |
| 39 | + public IEnumerable<double> FontSizeOptions { get; } = new[] { double.NaN, 8, 12, 16, 20, 24, 28 }; |
| 40 | + public IEnumerable<FontFamily> FontFamilyOptions { get; } = new FontFamily[] { DefaultFontFamily }.Concat(Fonts.SystemFontFamilies.OrderBy(f => f.Source)); |
23 | 41 |
|
24 | 42 | public bool FloatHint
|
25 | 43 | {
|
@@ -81,6 +99,16 @@ public bool ShowLeadingIcon
|
81 | 99 | }
|
82 | 100 | }
|
83 | 101 |
|
| 102 | + public bool ShowTrailingIcon |
| 103 | + { |
| 104 | + get => _showTrailingIcon; |
| 105 | + set |
| 106 | + { |
| 107 | + _showTrailingIcon = value; |
| 108 | + OnPropertyChanged(); |
| 109 | + } |
| 110 | + } |
| 111 | + |
84 | 112 | public string HintText
|
85 | 113 | {
|
86 | 114 | get => _hintText;
|
@@ -120,4 +148,84 @@ public Thickness SelectedCustomPadding
|
120 | 148 | OnPropertyChanged();
|
121 | 149 | }
|
122 | 150 | }
|
| 151 | + |
| 152 | + public double SelectedCustomHeight |
| 153 | + { |
| 154 | + get => _selectedCustomHeight; |
| 155 | + set |
| 156 | + { |
| 157 | + _selectedCustomHeight = value; |
| 158 | + OnPropertyChanged(); |
| 159 | + } |
| 160 | + } |
| 161 | + |
| 162 | + public VerticalAlignment SelectedVerticalAlignment |
| 163 | + { |
| 164 | + get => _selectedVerticalAlignment; |
| 165 | + set |
| 166 | + { |
| 167 | + _selectedVerticalAlignment = value; |
| 168 | + OnPropertyChanged(); |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + public double SelectedLeadingIconSize |
| 173 | + { |
| 174 | + get => _selectedLeadingIconSize; |
| 175 | + set |
| 176 | + { |
| 177 | + _selectedLeadingIconSize = value; |
| 178 | + OnPropertyChanged(); |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | + public double SelectedTrailingIconSize |
| 183 | + { |
| 184 | + get => _selectedTrailingIconSize; |
| 185 | + set |
| 186 | + { |
| 187 | + _selectedTrailingIconSize = value; |
| 188 | + OnPropertyChanged(); |
| 189 | + } |
| 190 | + } |
| 191 | + |
| 192 | + public string? PrefixText |
| 193 | + { |
| 194 | + get => _prefixText; |
| 195 | + set |
| 196 | + { |
| 197 | + _prefixText = value; |
| 198 | + OnPropertyChanged(); |
| 199 | + } |
| 200 | + } |
| 201 | + |
| 202 | + public string? SuffixText |
| 203 | + { |
| 204 | + get => _suffixText; |
| 205 | + set |
| 206 | + { |
| 207 | + _suffixText = value; |
| 208 | + OnPropertyChanged(); |
| 209 | + } |
| 210 | + } |
| 211 | + |
| 212 | + public double SelectedFontSize |
| 213 | + { |
| 214 | + get => _selectedFontSize; |
| 215 | + set |
| 216 | + { |
| 217 | + _selectedFontSize = value; |
| 218 | + OnPropertyChanged(); |
| 219 | + } |
| 220 | + } |
| 221 | + |
| 222 | + public FontFamily? SelectedFontFamily |
| 223 | + { |
| 224 | + get => _selectedFontFamily; |
| 225 | + set |
| 226 | + { |
| 227 | + _selectedFontFamily = value; |
| 228 | + OnPropertyChanged(); |
| 229 | + } |
| 230 | + } |
123 | 231 | }
|
0 commit comments