Skip to content

Commit b3607bf

Browse files
authored
Merge branch 'main' into datagrid-issues-fix
2 parents ec981ae + 2afbe94 commit b3607bf

38 files changed

+467
-309
lines changed

.github/workflows/wpf-ui-cd-nuget.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: wpf-ui-cd-nuget
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
7+
- release/*
68
paths:
79
- 'src/**'
810

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ https://marketplace.visualstudio.com/items?itemName=lepo.wpf-ui
6868

6969
## 📖 Documentation
7070

71-
Documentation can be found at https://wpfui.lepo.co/. We also have a [tutorial](https://wpfui.lepo.co/tutorial/) over there for newcomers.
71+
Documentation can be found at https://wpfui.lepo.co/. We also have a [tutorial](#-getting-started) over there for newcomers.
7272

7373
## 🚧 Development
7474

docs/toc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ items:
2828
href: documentation/releases.md
2929
- name: API v4.0
3030
href: api/
31-
- name: Suppport plans
31+
- name: Support plans
3232
href: https://lepo.co/support

samples/Wpf.Ui.Demo.Mvvm/ViewModels/ViewModel.cs

+6-22
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ namespace Wpf.Ui.Demo.Mvvm.ViewModels;
1010
public abstract class ViewModel : ObservableObject, INavigationAware
1111
{
1212
/// <inheritdoc />
13-
public virtual async Task OnNavigatedToAsync()
13+
public virtual Task OnNavigatedToAsync()
1414
{
15-
using CancellationTokenSource cts = new();
15+
OnNavigatedTo();
1616

17-
await DispatchAsync(OnNavigatedTo, cts.Token);
17+
return Task.CompletedTask;
1818
}
1919

2020
/// <summary>
@@ -24,32 +24,16 @@ public virtual async Task OnNavigatedToAsync()
2424
public virtual void OnNavigatedTo() { }
2525

2626
/// <inheritdoc />
27-
public virtual async Task OnNavigatedFromAsync()
27+
public virtual Task OnNavigatedFromAsync()
2828
{
29-
using CancellationTokenSource cts = new();
29+
OnNavigatedFrom();
3030

31-
await DispatchAsync(OnNavigatedFrom, cts.Token);
31+
return Task.CompletedTask;
3232
}
3333

3434
/// <summary>
3535
/// Handles the event that is fired before the component is navigated from.
3636
/// </summary>
3737
// ReSharper disable once MemberCanBeProtected.Global
3838
public virtual void OnNavigatedFrom() { }
39-
40-
/// <summary>
41-
/// Dispatches the specified action on the UI thread.
42-
/// </summary>
43-
/// <param name="action">The action to be dispatched.</param>
44-
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
45-
/// <returns>A task that represents the asynchronous operation.</returns>
46-
protected static async Task DispatchAsync(Action action, CancellationToken cancellationToken)
47-
{
48-
if (cancellationToken.IsCancellationRequested)
49-
{
50-
return;
51-
}
52-
53-
await Application.Current.Dispatcher.InvokeAsync(action);
54-
}
5539
}

src/Wpf.Ui.Gallery/ViewModels/ViewModel.cs

+6-22
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace Wpf.Ui.Gallery.ViewModels;
88
public abstract partial class ViewModel : ObservableObject, INavigationAware
99
{
1010
/// <inheritdoc />
11-
public virtual async Task OnNavigatedToAsync()
11+
public virtual Task OnNavigatedToAsync()
1212
{
13-
using CancellationTokenSource cts = new();
13+
OnNavigatedTo();
1414

15-
await DispatchAsync(OnNavigatedTo, cts.Token);
15+
return Task.CompletedTask;
1616
}
1717

1818
/// <summary>
@@ -22,32 +22,16 @@ public virtual async Task OnNavigatedToAsync()
2222
public virtual void OnNavigatedTo() { }
2323

2424
/// <inheritdoc />
25-
public virtual async Task OnNavigatedFromAsync()
25+
public virtual Task OnNavigatedFromAsync()
2626
{
27-
using CancellationTokenSource cts = new();
27+
OnNavigatedFrom();
2828

29-
await DispatchAsync(OnNavigatedFrom, cts.Token);
29+
return Task.CompletedTask;
3030
}
3131

3232
/// <summary>
3333
/// Handles the event that is fired before the component is navigated from.
3434
/// </summary>
3535
// ReSharper disable once MemberCanBeProtected.Global
3636
public virtual void OnNavigatedFrom() { }
37-
38-
/// <summary>
39-
/// Dispatches the specified action on the UI thread.
40-
/// </summary>
41-
/// <param name="action">The action to be dispatched.</param>
42-
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
43-
/// <returns>A task that represents the asynchronous operation.</returns>
44-
protected static async Task DispatchAsync(Action action, CancellationToken cancellationToken)
45-
{
46-
if (cancellationToken.IsCancellationRequested)
47-
{
48-
return;
49-
}
50-
51-
await Application.Current.Dispatcher.InvokeAsync(action);
52-
}
5337
}

src/Wpf.Ui.Gallery/Views/Pages/BasicInput/RadioButtonPage.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
Grid.Column="1"
4747
Command="{Binding ViewModel.RadioButtonCheckboxCheckedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:RadioButtonPage}, Mode=OneWay}"
4848
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay}"
49-
Content="Disable RadioButton's" />
49+
Content="Disable radio buttons" />
5050
</Grid>
5151
</controls:ControlExample>
5252

src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
44
// All Rights Reserved.
55

6-
using Wpf.Ui.Extensions;
76
using Wpf.Ui.Interop;
87

98
namespace Wpf.Ui.Appearance;

src/Wpf.Ui/Appearance/ApplicationThemeManager.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public static void Apply(FrameworkElement frameworkElement)
142142

143143
ResourceDictionary[] resourcesRemove = frameworkElement
144144
.Resources.MergedDictionaries.Where(e => e.Source is not null)
145-
.Where(e => e.Source.ToString().ToLower().Contains(LibraryNamespace))
145+
.Where(e => e.Source.ToString().Contains(LibraryNamespace, StringComparison.OrdinalIgnoreCase))
146146
.ToArray();
147147

148148
foreach (ResourceDictionary? resource in UiApplication.Current.Resources.MergedDictionaries)
@@ -288,19 +288,19 @@ private static void FetchApplicationTheme()
288288
return;
289289
}
290290

291-
string themeUri = themeDictionary.Source.ToString().Trim().ToLower();
291+
string themeUri = themeDictionary.Source.ToString();
292292

293-
if (themeUri.Contains("light"))
293+
if (themeUri.Contains("light", StringComparison.OrdinalIgnoreCase))
294294
{
295295
_cachedApplicationTheme = ApplicationTheme.Light;
296296
}
297297

298-
if (themeUri.Contains("dark"))
298+
if (themeUri.Contains("dark", StringComparison.OrdinalIgnoreCase))
299299
{
300300
_cachedApplicationTheme = ApplicationTheme.Dark;
301301
}
302302

303-
if (themeUri.Contains("highcontrast"))
303+
if (themeUri.Contains("highcontrast", StringComparison.OrdinalIgnoreCase))
304304
{
305305
_cachedApplicationTheme = ApplicationTheme.HighContrast;
306306
}

src/Wpf.Ui/Appearance/ResourceDictionaryManager.cs

+11-16
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,17 @@ public bool HasDictionary(string resourceLookup)
4646
return null;
4747
}
4848

49-
resourceLookup = resourceLookup.ToLower().Trim();
50-
5149
foreach (ResourceDictionary t in applicationDictionaries)
5250
{
5351
string resourceDictionaryUri;
5452

5553
if (t?.Source != null)
5654
{
57-
resourceDictionaryUri = t.Source.ToString().ToLower().Trim();
55+
resourceDictionaryUri = t.Source.ToString();
5856

5957
if (
60-
resourceDictionaryUri.Contains(SearchNamespace)
61-
&& resourceDictionaryUri.Contains(resourceLookup)
58+
resourceDictionaryUri.Contains(SearchNamespace, StringComparison.OrdinalIgnoreCase)
59+
&& resourceDictionaryUri.Contains(resourceLookup, StringComparison.OrdinalIgnoreCase)
6260
)
6361
{
6462
return t;
@@ -72,11 +70,11 @@ public bool HasDictionary(string resourceLookup)
7270
continue;
7371
}
7472

75-
resourceDictionaryUri = t1.Source.ToString().ToLower().Trim();
73+
resourceDictionaryUri = t1.Source.ToString();
7674

7775
if (
78-
!resourceDictionaryUri.Contains(SearchNamespace)
79-
|| !resourceDictionaryUri.Contains(resourceLookup)
76+
!resourceDictionaryUri.Contains(SearchNamespace, StringComparison.OrdinalIgnoreCase)
77+
|| !resourceDictionaryUri.Contains(resourceLookup, StringComparison.OrdinalIgnoreCase)
8078
)
8179
{
8280
continue;
@@ -107,17 +105,15 @@ public bool UpdateDictionary(string resourceLookup, Uri? newResourceUri)
107105
return false;
108106
}
109107

110-
resourceLookup = resourceLookup.ToLower().Trim();
111-
112108
for (var i = 0; i < applicationDictionaries.Count; i++)
113109
{
114110
string sourceUri;
115111

116112
if (applicationDictionaries[i]?.Source != null)
117113
{
118-
sourceUri = applicationDictionaries[i].Source.ToString().ToLower().Trim();
114+
sourceUri = applicationDictionaries[i].Source.ToString();
119115

120-
if (sourceUri.Contains(SearchNamespace) && sourceUri.Contains(resourceLookup))
116+
if (sourceUri.Contains(SearchNamespace, StringComparison.OrdinalIgnoreCase) && sourceUri.Contains(resourceLookup, StringComparison.OrdinalIgnoreCase))
121117
{
122118
applicationDictionaries[i] = new() { Source = newResourceUri };
123119

@@ -134,11 +130,10 @@ public bool UpdateDictionary(string resourceLookup, Uri? newResourceUri)
134130

135131
sourceUri = applicationDictionaries[i]
136132
.MergedDictionaries[j]
137-
.Source.ToString()
138-
.ToLower()
139-
.Trim();
133+
.Source
134+
.ToString();
140135

141-
if (!sourceUri.Contains(SearchNamespace) || !sourceUri.Contains(resourceLookup))
136+
if (!sourceUri.Contains(SearchNamespace, StringComparison.OrdinalIgnoreCase) || !sourceUri.Contains(resourceLookup, StringComparison.OrdinalIgnoreCase))
142137
{
143138
continue;
144139
}

src/Wpf.Ui/Appearance/SystemThemeManager.cs

+11-13
Original file line numberDiff line numberDiff line change
@@ -69,60 +69,58 @@ private static SystemTheme GetCurrentSystemTheme()
6969

7070
if (!string.IsNullOrEmpty(currentTheme))
7171
{
72-
currentTheme = currentTheme.ToLower().Trim();
73-
7472
// This may be changed in the next versions, check the Insider previews
75-
if (currentTheme.Contains("basic.theme"))
73+
if (currentTheme.Contains("basic.theme", StringComparison.OrdinalIgnoreCase))
7674
{
7775
return SystemTheme.Light;
7876
}
7977

80-
if (currentTheme.Contains("aero.theme"))
78+
if (currentTheme.Contains("aero.theme", StringComparison.OrdinalIgnoreCase))
8179
{
8280
return SystemTheme.Light;
8381
}
8482

85-
if (currentTheme.Contains("dark.theme"))
83+
if (currentTheme.Contains("dark.theme", StringComparison.OrdinalIgnoreCase))
8684
{
8785
return SystemTheme.Dark;
8886
}
8987

90-
if (currentTheme.Contains("hcblack.theme"))
88+
if (currentTheme.Contains("hcblack.theme", StringComparison.OrdinalIgnoreCase))
9189
{
9290
return SystemTheme.HCBlack;
9391
}
9492

95-
if (currentTheme.Contains("hcwhite.theme"))
93+
if (currentTheme.Contains("hcwhite.theme", StringComparison.OrdinalIgnoreCase))
9694
{
9795
return SystemTheme.HCWhite;
9896
}
9997

100-
if (currentTheme.Contains("hc1.theme"))
98+
if (currentTheme.Contains("hc1.theme", StringComparison.OrdinalIgnoreCase))
10199
{
102100
return SystemTheme.HC1;
103101
}
104102

105-
if (currentTheme.Contains("hc2.theme"))
103+
if (currentTheme.Contains("hc2.theme", StringComparison.OrdinalIgnoreCase))
106104
{
107105
return SystemTheme.HC2;
108106
}
109107

110-
if (currentTheme.Contains("themea.theme"))
108+
if (currentTheme.Contains("themea.theme", StringComparison.OrdinalIgnoreCase))
111109
{
112110
return SystemTheme.Glow;
113111
}
114112

115-
if (currentTheme.Contains("themeb.theme"))
113+
if (currentTheme.Contains("themeb.theme", StringComparison.OrdinalIgnoreCase))
116114
{
117115
return SystemTheme.CapturedMotion;
118116
}
119117

120-
if (currentTheme.Contains("themec.theme"))
118+
if (currentTheme.Contains("themec.theme", StringComparison.OrdinalIgnoreCase))
121119
{
122120
return SystemTheme.Sunrise;
123121
}
124122

125-
if (currentTheme.Contains("themed.theme"))
123+
if (currentTheme.Contains("themed.theme", StringComparison.OrdinalIgnoreCase))
126124
{
127125
return SystemTheme.Flow;
128126
}

src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,13 @@ private void DefaultFiltering(string text)
551551
return;
552552
}
553553

554-
var splitText = text.ToLowerInvariant().Split(' ');
554+
var splitText = text.Split(' ');
555555
var suitableItems = OriginalItemsSource
556556
.Cast<object>()
557557
.Where(item =>
558558
{
559-
var itemText = GetStringFromObj(item)?.ToLowerInvariant();
560-
return splitText.All(key => itemText?.Contains(key) ?? false);
559+
var itemText = GetStringFromObj(item);
560+
return splitText.All(key => itemText?.Contains(key, StringComparison.OrdinalIgnoreCase) ?? false);
561561
})
562562
.ToList();
563563

src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
Icon="{TemplateBinding Icon}"
124124
IconPlacement="Right"
125125
PlaceholderText="{TemplateBinding PlaceholderText}"
126-
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}" />
126+
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
127127

128128
<Popup
129129
x:Name="PART_SuggestionsPopup"

src/Wpf.Ui/Controls/BreadcrumbBar/BreadcrumbBarItem.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/* Based on Windows UI Library */
77

8-
using Wpf.Ui.Converters;
8+
99

1010
// ReSharper disable once CheckNamespace
1111
namespace Wpf.Ui.Controls;

0 commit comments

Comments
 (0)