diff --git a/.gitignore b/.gitignore
index 23b8efffa0..7b9a7c5a25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,6 +170,7 @@ $RECYCLE.BIN/
## VS Code
#################
.vscode/
+*.lscache
#################
## Cake
diff --git a/Directory.Packages.props b/Directory.Packages.props
index e7d59ee139..7d2780e29e 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -15,9 +15,10 @@
-
-
-
+
+
+
+
diff --git a/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml b/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml
index 3ce911d9f8..16765b4921 100644
--- a/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml
+++ b/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml
@@ -29,10 +29,19 @@
HorizontalAlignment="Stretch"
SelectionChanged="OnBgPresetChanged">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,8 +50,15 @@
HorizontalAlignment="Stretch"
SelectionChanged="OnFgChanged">
-
-
+
+
+
+
+
+
+
+
+
diff --git a/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml.cs b/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml.cs
index 52c98757f0..2445bde045 100644
--- a/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/CommandBar/CommandBarCustomizationPage.xaml.cs
@@ -14,16 +14,16 @@ namespace ControlCatalog.Pages
{
if (LiveBar == null)
return;
-
- switch (BgPresetCombo.SelectedIndex)
+
+ if (BgPresetCombo.SelectedItem is not ComboBoxItem { Tag: string preset })
{
- case 1:
- LiveBar.Background = new SolidColorBrush(Color.Parse("#0078D4"));
- break;
- case 2:
- LiveBar.Background = new SolidColorBrush(Color.Parse("#1C1C1E"));
- break;
- case 3:
+ LiveBar.ClearValue(BackgroundProperty);
+ return;
+ }
+
+ switch (preset)
+ {
+ case "Gradient":
LiveBar.Background = new LinearGradientBrush
{
StartPoint = new Avalonia.RelativePoint(0, 0, Avalonia.RelativeUnit.Relative),
@@ -35,11 +35,11 @@ namespace ControlCatalog.Pages
}
};
break;
- case 4:
+ case "Transparent":
LiveBar.Background = Brushes.Transparent;
break;
default:
- LiveBar.ClearValue(BackgroundProperty);
+ LiveBar.Background = new SolidColorBrush(Color.Parse(preset));
break;
}
}
@@ -48,19 +48,14 @@ namespace ControlCatalog.Pages
{
if (LiveBar == null)
return;
-
- switch (FgCombo.SelectedIndex)
+
+ if (FgCombo.SelectedItem is ComboBoxItem { Tag: string color })
{
- case 1:
- LiveBar.Foreground = Brushes.White;
- break;
- case 2:
- LiveBar.Foreground = Brushes.Black;
- break;
- default:
- LiveBar.ClearValue(ForegroundProperty);
- break;
+ LiveBar.Foreground = new SolidColorBrush(Color.Parse(color));
+ return;
}
+
+ LiveBar.ClearValue(ForegroundProperty);
}
private void OnRadiusChanged(object? sender, Avalonia.Controls.Primitives.RangeBaseValueChangedEventArgs e)
diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel_PageList.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel_PageList.cs
index 4c85f64765..03047bedae 100644
--- a/samples/ControlCatalog/ViewModels/MainWindowViewModel_PageList.cs
+++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel_PageList.cs
@@ -7,6 +7,8 @@ using Avalonia;
using MiniMvvm;
using Avalonia.Collections;
using ControlCatalog.Pages;
+using System.Globalization;
+using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
@@ -105,10 +107,29 @@ namespace ControlCatalog.ViewModels
_ignoreListChange = true;
Pages.Clear();
- if (!string.IsNullOrWhiteSpace(query))
- Pages.AddRange(_items.Where(x => x.Header.Contains(query)));
- else
+ if (string.IsNullOrWhiteSpace(query))
+ {
Pages.AddRange(_items);
+ }
+ else
+ {
+ var querySearchKey = PageItem.CreateSearchKey(query);
+
+ if (querySearchKey.Length == 0)
+ {
+ Pages.AddRange(_items);
+ }
+ else
+ {
+ foreach (var item in _items)
+ {
+ if (item.MatchesSearch(querySearchKey))
+ {
+ Pages.Add(item);
+ }
+ }
+ }
+ }
}
finally
{
@@ -190,7 +211,38 @@ namespace ControlCatalog.ViewModels
public string Header { get; } = header;
public Func