Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion MainDemo.Wpf/Domain/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ private static IEnumerable<DemoItem> GenerateDemoItems(ISnackbarMessageQueue sna
{
DocumentationLink.DemoPageLink<SmartHint>(),
DocumentationLink.StyleLink("SmartHint"),
});
})
{
//The smart hint view handles its own scrolling
HorizontalScrollBarVisibilityRequirement = ScrollBarVisibility.Disabled,
VerticalScrollBarVisibilityRequirement = ScrollBarVisibility.Disabled
};

yield return new DemoItem(
"PopupBox",
Expand Down
81 changes: 70 additions & 11 deletions MainDemo.Wpf/Domain/SmartHintViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,39 @@ internal class SmartHintViewModel : ViewModelBase
private bool _applyCustomPadding;
private Thickness _selectedCustomPadding = new(5);
private double _selectedCustomHeight = double.NaN;
private VerticalAlignment _selectedVerticalAlignment = VerticalAlignment.Center;
private VerticalAlignment _selectedVerticalAlignment = VerticalAlignment.Stretch;
private double _selectedLeadingIconSize = 20;
private double _selectedTrailingIconSize = 20;
private string? _prefixText;
private string? _suffixText;
private VerticalAlignment _selectedIconVerticalAlignment = VerticalAlignment.Center;
private string? _prefixText = "pre";
private string? _suffixText = "suf";
private double _selectedFontSize = double.NaN;
private FontFamily? _selectedFontFamily = DefaultFontFamily;
private bool _controlsEnabled = true;
private bool _rippleOnFocus = false;
private bool _textBoxAcceptsReturn = false;
private int _maxLength;
private PrefixSuffixVisibility _selectedPrefixVisibility = PrefixSuffixVisibility.WhenFocusedOrNonEmpty;
private PrefixSuffixHintBehavior _selectedPrefixHintBehavior = PrefixSuffixHintBehavior.AlignWithPrefixSuffix;
private PrefixSuffixVisibility _selectedSuffixVisibility = PrefixSuffixVisibility.WhenFocusedOrNonEmpty;
private PrefixSuffixHintBehavior _selectedSuffixHintBehavior = PrefixSuffixHintBehavior.AlignWithPrefixSuffix;
private bool _newSpecHighlightingEnabled;
private ScrollBarVisibility _selectedVerticalScrollBarVisibility = ScrollBarVisibility.Auto;
private ScrollBarVisibility _selectedHorizontalScrollBarVisibility = ScrollBarVisibility.Auto;

public IEnumerable<FloatingHintHorizontalAlignment> HorizontalAlignmentOptions { get; } = Enum.GetValues(typeof(FloatingHintHorizontalAlignment)).OfType<FloatingHintHorizontalAlignment>();
public IEnumerable<double> FloatingScaleOptions { get; } = new[] {0.25, 0.5, 0.75, 1.0};
public IEnumerable<Point> FloatingOffsetOptions { get; } = new[] { DefaultFloatingOffset, new Point(0, -25), new Point(16, -16), new Point(-16, -16), new Point(0, -50) };
public IEnumerable<string> ComboBoxOptions { get; } = new[] {"Option 1", "Option 2", "Option 3"};
public IEnumerable<Thickness> CustomPaddingOptions { get; } = new [] { new Thickness(0), new Thickness(5), new Thickness(10), new Thickness(15) };
public IEnumerable<double> CustomHeightOptions { get; } = new[] { double.NaN, 50, 75, 100 };
public IEnumerable<VerticalAlignment> VerticalAlignmentOptions { get; } = (VerticalAlignment[])Enum.GetValues(typeof(VerticalAlignment));
public IEnumerable<double> IconSizeOptions { get; } = new[] { 10.0, 15, 20, 30, 50, 75 };
public IEnumerable<double> FontSizeOptions { get; } = new[] { double.NaN, 8, 12, 16, 20, 24, 28 };
public IEnumerable<double> FloatingScaleOptions { get; } = [0.25, 0.5, 0.75, 1.0];
public IEnumerable<Point> FloatingOffsetOptions { get; } = [DefaultFloatingOffset, new Point(0, -25), new Point(16, -16), new Point(-16, -16), new Point(0, -50)];
public IEnumerable<string> ComboBoxOptions { get; } = ["Option 1", "Option 2", "Option 3"];
public IEnumerable<Thickness> CustomPaddingOptions { get; } = [new Thickness(0), new Thickness(5), new Thickness(10), new Thickness(15)];
public IEnumerable<double> CustomHeightOptions { get; } = [double.NaN, 50, 75, 100, 150];
public IEnumerable<VerticalAlignment> VerticalAlignmentOptions { get; } = Enum.GetValues(typeof(VerticalAlignment)).OfType<VerticalAlignment>();
public IEnumerable<double> IconSizeOptions { get; } = [10.0, 15, 20, 30, 50, 75];
public IEnumerable<double> FontSizeOptions { get; } = [double.NaN, 8, 12, 16, 20, 24, 28];
public IEnumerable<FontFamily> FontFamilyOptions { get; } = new FontFamily[] { DefaultFontFamily }.Concat(Fonts.SystemFontFamilies.OrderBy(f => f.Source));
public IEnumerable<PrefixSuffixVisibility> PrefixSuffixVisibilityOptions { get; } = Enum.GetValues(typeof(PrefixSuffixVisibility)).OfType<PrefixSuffixVisibility>();
public IEnumerable<PrefixSuffixHintBehavior> PrefixSuffixHintBehaviorOptions { get; } = Enum.GetValues(typeof(PrefixSuffixHintBehavior)).OfType<PrefixSuffixHintBehavior>();
public IEnumerable<ScrollBarVisibility> ScrollBarVisibilityOptions { get; } = Enum.GetValues(typeof(ScrollBarVisibility)).OfType<ScrollBarVisibility>();

public bool FloatHint
{
Expand Down Expand Up @@ -140,6 +151,12 @@ public double SelectedTrailingIconSize
set => SetProperty(ref _selectedTrailingIconSize, value);
}

public VerticalAlignment SelectedIconVerticalAlignment
{
get => _selectedIconVerticalAlignment;
set => SetProperty(ref _selectedIconVerticalAlignment, value);
}

public string? PrefixText
{
get => _prefixText;
Expand Down Expand Up @@ -199,4 +216,46 @@ public int MaxLength
}
}
}

public PrefixSuffixVisibility SelectedPrefixVisibility
{
get => _selectedPrefixVisibility;
set => SetProperty(ref _selectedPrefixVisibility, value);
}

public PrefixSuffixHintBehavior SelectedPrefixHintBehavior
{
get => _selectedPrefixHintBehavior;
set => SetProperty(ref _selectedPrefixHintBehavior, value);
}

public PrefixSuffixVisibility SelectedSuffixVisibility
{
get => _selectedSuffixVisibility;
set => SetProperty(ref _selectedSuffixVisibility, value);
}

public PrefixSuffixHintBehavior SelectedSuffixHintBehavior
{
get => _selectedSuffixHintBehavior;
set => SetProperty(ref _selectedSuffixHintBehavior, value);
}

public bool NewSpecHighlightingEnabled
{
get => _newSpecHighlightingEnabled;
set => SetProperty(ref _newSpecHighlightingEnabled, value);
}

public ScrollBarVisibility SelectedVerticalScrollBarVisibility
{
get => _selectedVerticalScrollBarVisibility;
set => SetProperty(ref _selectedVerticalScrollBarVisibility, value);
}

public ScrollBarVisibility SelectedHorizontalScrollBarVisibility
{
get => _selectedHorizontalScrollBarVisibility;
set => SetProperty(ref _selectedHorizontalScrollBarVisibility, value);
}
}
2 changes: 1 addition & 1 deletion MainDemo.Wpf/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Demo App": {
"commandName": "Project",
"commandLineArgs": "-p Home -t Inherit -f LeftToRight"
"commandLineArgs": "-p \"Smart Hint\" -t Inherit -f LeftToRight"
}
}
}
Loading