diff --git a/src/Avalonia.Base/Controls/ResourceDictionary.cs b/src/Avalonia.Base/Controls/ResourceDictionary.cs
index b928cf0672..285031e256 100644
--- a/src/Avalonia.Base/Controls/ResourceDictionary.cs
+++ b/src/Avalonia.Base/Controls/ResourceDictionary.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Avalonia.Collections;
using Avalonia.Controls.Templates;
@@ -13,11 +14,10 @@ namespace Avalonia.Controls
///
/// An indexed dictionary of resources.
///
- public class ResourceDictionary : IResourceDictionary, IThemeVariantProvider
+ public class ResourceDictionary : ResourceProvider, IResourceDictionary, IThemeVariantProvider
{
private object? lastDeferredItemKey;
private Dictionary? _inner;
- private IResourceHost? _owner;
private AvaloniaList? _mergedDictionaries;
private AvaloniaDictionary? _themeDictionary;
@@ -29,7 +29,7 @@ namespace Avalonia.Controls
///
/// Initializes a new instance of the class.
///
- public ResourceDictionary(IResourceHost owner) => Owner = owner;
+ public ResourceDictionary(IResourceHost owner) : base(owner) { }
public int Count => _inner?.Count ?? 0;
@@ -50,19 +50,6 @@ namespace Avalonia.Controls
public ICollection Keys => (ICollection?)_inner?.Keys ?? Array.Empty();
public ICollection Values => (ICollection?)_inner?.Values ?? Array.Empty();
- public IResourceHost? Owner
- {
- get => _owner;
- private set
- {
- if (_owner != value)
- {
- _owner = value;
- OwnerChanged?.Invoke(this, EventArgs.Empty);
- }
- }
- }
-
public IList MergedDictionaries
{
get
@@ -123,7 +110,7 @@ namespace Avalonia.Controls
ThemeVariant? IThemeVariantProvider.Key { get; set; }
- bool IResourceNode.HasResources
+ public sealed override bool HasResources
{
get
{
@@ -150,9 +137,7 @@ namespace Avalonia.Controls
bool ICollection>.IsReadOnly => false;
private Dictionary Inner => _inner ??= new();
-
- public event EventHandler? OwnerChanged;
-
+
public void Add(object key, object? value)
{
Inner.Add(key, value);
@@ -187,7 +172,7 @@ namespace Avalonia.Controls
return false;
}
- public bool TryGetResource(object key, ThemeVariant? theme, out object? value)
+ public sealed override bool TryGetResource(object key, ThemeVariant? theme, out object? value)
{
if (TryGetValue(key, out value))
return true;
@@ -316,17 +301,8 @@ namespace Avalonia.Controls
return false;
}
- void IResourceProvider.AddOwner(IResourceHost owner)
+ protected sealed override void OnAddOwner(IResourceHost owner)
{
- owner = owner ?? throw new ArgumentNullException(nameof(owner));
-
- if (Owner != null)
- {
- throw new InvalidOperationException("The ResourceDictionary already has a parent.");
- }
-
- Owner = owner;
-
var hasResources = _inner?.Count > 0;
if (_mergedDictionaries is not null)
@@ -352,37 +328,30 @@ namespace Avalonia.Controls
}
}
- void IResourceProvider.RemoveOwner(IResourceHost owner)
+ protected sealed override void OnRemoveOwner(IResourceHost owner)
{
- owner = owner ?? throw new ArgumentNullException(nameof(owner));
+ var hasResources = _inner?.Count > 0;
- if (Owner == owner)
+ if (_mergedDictionaries is not null)
{
- Owner = null;
-
- var hasResources = _inner?.Count > 0;
-
- if (_mergedDictionaries is not null)
+ foreach (var i in _mergedDictionaries)
{
- foreach (var i in _mergedDictionaries)
- {
- i.RemoveOwner(owner);
- hasResources |= i.HasResources;
- }
+ i.RemoveOwner(owner);
+ hasResources |= i.HasResources;
}
- if (_themeDictionary is not null)
+ }
+ if (_themeDictionary is not null)
+ {
+ foreach (var i in _themeDictionary.Values)
{
- foreach (var i in _themeDictionary.Values)
- {
- i.RemoveOwner(owner);
- hasResources |= i.HasResources;
- }
+ i.RemoveOwner(owner);
+ hasResources |= i.HasResources;
}
+ }
- if (hasResources)
- {
- owner.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
- }
+ if (hasResources)
+ {
+ owner.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
}
}
diff --git a/src/Avalonia.Base/Controls/ResourceProvider.cs b/src/Avalonia.Base/Controls/ResourceProvider.cs
new file mode 100644
index 0000000000..f10a816845
--- /dev/null
+++ b/src/Avalonia.Base/Controls/ResourceProvider.cs
@@ -0,0 +1,102 @@
+using System;
+using Avalonia.Styling;
+
+namespace Avalonia.Controls;
+
+///
+/// Base implementation for IResourceProvider interface.
+/// Includes Owner property management.
+///
+public abstract class ResourceProvider : IResourceProvider
+{
+ private IResourceHost? _owner;
+
+ public ResourceProvider()
+ {
+ }
+
+ public ResourceProvider(IResourceHost owner)
+ {
+ _owner = owner;
+ }
+
+ ///
+ public abstract bool HasResources { get; }
+
+ ///
+ public abstract bool TryGetResource(object key, ThemeVariant? theme, out object? value);
+
+ ///
+ public IResourceHost? Owner
+ {
+ get => _owner;
+ private set
+ {
+ if (_owner != value)
+ {
+ _owner = value;
+ OwnerChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ ///
+ public event EventHandler? OwnerChanged;
+
+ protected void RaiseResourcesChanged()
+ {
+ Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
+ }
+
+ ///
+ /// Handles when owner was added.
+ /// Base method implementation raises , if this provider has any resources.
+ ///
+ /// New owner.
+ protected virtual void OnAddOwner(IResourceHost owner)
+ {
+ if (HasResources)
+ {
+ owner.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
+ }
+ }
+
+ ///
+ /// Handles when owner was removed.
+ /// Base method implementation raises , if this provider has any resources.
+ ///
+ /// Old owner.
+ protected virtual void OnRemoveOwner(IResourceHost owner)
+ {
+ if (HasResources)
+ {
+ owner.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
+ }
+ }
+
+ void IResourceProvider.AddOwner(IResourceHost owner)
+ {
+ owner = owner ?? throw new ArgumentNullException(nameof(owner));
+
+ if (Owner != null)
+ {
+ throw new InvalidOperationException("The ResourceDictionary already has a parent.");
+ }
+
+ Owner = owner;
+
+ OnAddOwner(owner);
+ }
+
+ void IResourceProvider.RemoveOwner(IResourceHost owner)
+ {
+ owner = owner ?? throw new ArgumentNullException(nameof(owner));
+
+ if (Owner == owner)
+ {
+ Owner = null;
+
+ OnRemoveOwner(owner);
+ }
+ }
+}
diff --git a/src/Avalonia.Controls/DateTimePickers/DatePicker.cs b/src/Avalonia.Controls/DateTimePickers/DatePicker.cs
index c1f2a63f84..212cb64b13 100644
--- a/src/Avalonia.Controls/DateTimePickers/DatePicker.cs
+++ b/src/Avalonia.Controls/DateTimePickers/DatePicker.cs
@@ -373,10 +373,11 @@ namespace Avalonia.Controls
}
else
{
+ // By clearing local value, we reset text property to the value from the template.
+ _monthText!.ClearValue(TextBlock.TextProperty);
+ _yearText!.ClearValue(TextBlock.TextProperty);
+ _dayText!.ClearValue(TextBlock.TextProperty);
PseudoClasses.Set(":hasnodate", true);
- _monthText!.Text = "month";
- _yearText!.Text = "year";
- _dayText!.Text = "day";
}
}
diff --git a/src/Avalonia.Controls/DateTimePickers/TimePicker.cs b/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
index 8eda9e1f0b..62ac76e71c 100644
--- a/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
+++ b/src/Avalonia.Controls/DateTimePickers/TimePicker.cs
@@ -190,10 +190,19 @@ namespace Avalonia.Controls
if (_contentGrid == null)
return;
- bool use24HourClock = ClockIdentifier == "24HourClock";
+ var use24HourClock = ClockIdentifier == "24HourClock";
- var columnsD = use24HourClock ? "*, Auto, *" : "*, Auto, *, Auto, *";
- _contentGrid.ColumnDefinitions = new ColumnDefinitions(columnsD);
+ var columnsD = new ColumnDefinitions();
+ columnsD.Add(new ColumnDefinition(GridLength.Star));
+ columnsD.Add(new ColumnDefinition(GridLength.Auto));
+ columnsD.Add(new ColumnDefinition(GridLength.Star));
+ if (!use24HourClock)
+ {
+ columnsD.Add(new ColumnDefinition(GridLength.Auto));
+ columnsD.Add(new ColumnDefinition(GridLength.Star));
+ }
+
+ _contentGrid.ColumnDefinitions = columnsD;
_thirdPickerHost!.IsVisible = !use24HourClock;
_secondSplitter!.IsVisible = !use24HourClock;
@@ -232,8 +241,9 @@ namespace Avalonia.Controls
}
else
{
- _hourText.Text = "hour";
- _minuteText.Text = "minute";
+ // By clearing local value, we reset text property to the value from the template.
+ _hourText.ClearValue(TextBlock.TextProperty);
+ _minuteText.ClearValue(TextBlock.TextProperty);
PseudoClasses.Set(":hasnotime", true);
_periodText.Text = DateTime.Now.Hour >= 12 ? TimeUtils.GetPMDesignator() : TimeUtils.GetAMDesignator();
diff --git a/src/Avalonia.Themes.Fluent/Accents/SystemAccentColors.cs b/src/Avalonia.Themes.Fluent/Accents/SystemAccentColors.cs
index a796a5704d..95f135a40a 100644
--- a/src/Avalonia.Themes.Fluent/Accents/SystemAccentColors.cs
+++ b/src/Avalonia.Themes.Fluent/Accents/SystemAccentColors.cs
@@ -6,7 +6,7 @@ using Avalonia.Styling;
namespace Avalonia.Themes.Fluent.Accents;
-internal class SystemAccentColors : IResourceProvider
+internal sealed class SystemAccentColors : ResourceProvider
{
public const string AccentKey = "SystemAccentColor";
public const string AccentDark1Key = "SystemAccentColorDark1";
@@ -22,8 +22,8 @@ internal class SystemAccentColors : IResourceProvider
private Color _systemAccentColorDark1, _systemAccentColorDark2, _systemAccentColorDark3;
private Color _systemAccentColorLight1, _systemAccentColorLight2, _systemAccentColorLight3;
- public bool HasResources => true;
- public bool TryGetResource(object key, ThemeVariant? theme, out object? value)
+ public override bool HasResources => true;
+ public override bool TryGetResource(object key, ThemeVariant? theme, out object? value)
{
if (key is string strKey)
{
@@ -81,38 +81,24 @@ internal class SystemAccentColors : IResourceProvider
return false;
}
- public IResourceHost? Owner { get; private set; }
- public event EventHandler? OwnerChanged;
- public void AddOwner(IResourceHost owner)
+ protected override void OnAddOwner(IResourceHost owner)
{
- if (Owner != owner)
+ if (GetFromOwner(owner) is { } platformSettings)
{
- Owner = owner;
- OwnerChanged?.Invoke(this, EventArgs.Empty);
-
- if (GetFromOwner(owner) is { } platformSettings)
- {
- platformSettings.ColorValuesChanged += PlatformSettingsOnColorValuesChanged;
- }
-
- _invalidateColors = true;
+ platformSettings.ColorValuesChanged += PlatformSettingsOnColorValuesChanged;
}
+
+ _invalidateColors = true;
}
- public void RemoveOwner(IResourceHost owner)
+ protected override void OnRemoveOwner(IResourceHost owner)
{
- if (Owner == owner)
+ if (GetFromOwner(owner) is { } platformSettings)
{
- Owner = null;
- OwnerChanged?.Invoke(this, EventArgs.Empty);
-
- if (GetFromOwner(owner) is { } platformSettings)
- {
- platformSettings.ColorValuesChanged -= PlatformSettingsOnColorValuesChanged;
- }
-
- _invalidateColors = true;
+ platformSettings.ColorValuesChanged -= PlatformSettingsOnColorValuesChanged;
}
+
+ _invalidateColors = true;
}
private void EnsureColors()
diff --git a/src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml b/src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
index 49f8174791..e7be603a16 100644
--- a/src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
+++ b/src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
@@ -97,12 +97,12 @@
VerticalAlignment="Stretch"
TemplatedControl.IsTemplateFocusTarget="True">
-
-
-
+
+
+
@@ -183,12 +184,12 @@
IsVisible="{Binding ShowFilters}"
ItemsSource="{Binding Filters}"
SelectedItem="{Binding SelectedFilter}" />
-
+
-
+
- OK
- Cancel
+
+
@@ -218,13 +219,13 @@
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml b/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
index adac85997e..f7ddb8c668 100644
--- a/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
+++ b/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
@@ -22,14 +22,14 @@
m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml b/src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
index 9f854f2f1e..64ac30128d 100644
--- a/src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
+++ b/src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
@@ -102,6 +102,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
@@ -117,6 +118,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/FluentTheme.xaml
index f4467e40ce..419b110ae7 100644
--- a/src/Avalonia.Themes.Fluent/FluentTheme.xaml
+++ b/src/Avalonia.Themes.Fluent/FluentTheme.xaml
@@ -15,6 +15,7 @@
+
diff --git a/src/Avalonia.Themes.Fluent/Strings/InvariantResources.xaml b/src/Avalonia.Themes.Fluent/Strings/InvariantResources.xaml
new file mode 100644
index 0000000000..56d5e309f7
--- /dev/null
+++ b/src/Avalonia.Themes.Fluent/Strings/InvariantResources.xaml
@@ -0,0 +1,28 @@
+
+
+ day
+ month
+ year
+
+ hour
+ minute
+
+ Cut
+ Copy
+ Paste
+
+ File name
+ Show hidden files
+ OK
+ Cancel
+ Name
+ Date Modified
+ Type
+ Size
+ {0} already exists. Do you want to replace it?
+ Yes
+ No
+
+
diff --git a/src/Avalonia.Themes.Simple/Avalonia.Themes.Simple.csproj b/src/Avalonia.Themes.Simple/Avalonia.Themes.Simple.csproj
index 9864cf24e0..5037a928c3 100644
--- a/src/Avalonia.Themes.Simple/Avalonia.Themes.Simple.csproj
+++ b/src/Avalonia.Themes.Simple/Avalonia.Themes.Simple.csproj
@@ -9,6 +9,9 @@
+
+
+
diff --git a/src/Avalonia.Themes.Simple/Controls/DatePicker.xaml b/src/Avalonia.Themes.Simple/Controls/DatePicker.xaml
index 6ead5019c6..d933afa43e 100644
--- a/src/Avalonia.Themes.Simple/Controls/DatePicker.xaml
+++ b/src/Avalonia.Themes.Simple/Controls/DatePicker.xaml
@@ -113,13 +113,13 @@
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
- Text="day" />
+ Text="{DynamicResource StringDatePickerDayText}" />
+ Text="{DynamicResource StringDatePickerYearText}" />
@@ -89,7 +90,7 @@
- Show hidden files
+
- OK
- Cancel
+
+
@@ -114,7 +115,7 @@
+ Watermark="{DynamicResource StringManagedFileChooserFileNameWatermark}" />
+ Text="{DynamicResource StringManagedFileChooserNameColumn}" />
+ Text="{DynamicResource StringManagedFileChooserDateModifiedColumn}" />
@@ -171,7 +172,7 @@
Fill="{DynamicResource ThemeControlMidBrush}"/>
+ Text="{DynamicResource StringManagedFileChooserTypeColumn}" />
+ Text="{DynamicResource StringManagedFileChooserSizeColumn}" />
@@ -253,18 +254,26 @@
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}">
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/src/Avalonia.Themes.Simple/Controls/TextBox.xaml b/src/Avalonia.Themes.Simple/Controls/TextBox.xaml
index b4757bc3f7..42824dc5fe 100644
--- a/src/Avalonia.Themes.Simple/Controls/TextBox.xaml
+++ b/src/Avalonia.Themes.Simple/Controls/TextBox.xaml
@@ -6,11 +6,11 @@
m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z
-
-
-
diff --git a/src/Avalonia.Themes.Simple/Controls/TimePicker.xaml b/src/Avalonia.Themes.Simple/Controls/TimePicker.xaml
index 3e11313250..61e3a1d2fc 100644
--- a/src/Avalonia.Themes.Simple/Controls/TimePicker.xaml
+++ b/src/Avalonia.Themes.Simple/Controls/TimePicker.xaml
@@ -110,6 +110,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
+
diff --git a/tests/Avalonia.Controls.UnitTests/DatePickerTests.cs b/tests/Avalonia.Controls.UnitTests/DatePickerTests.cs
index 75ec7b7e59..45b3f2b081 100644
--- a/tests/Avalonia.Controls.UnitTests/DatePickerTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/DatePickerTests.cs
@@ -192,16 +192,16 @@ namespace Avalonia.Controls.UnitTests
DateTimeOffset value = new DateTimeOffset(2000, 10, 10, 0, 0, 0, TimeSpan.Zero);
datePicker.SelectedDate = value;
- Assert.False(dayText.Text == "day");
- Assert.False(monthText.Text == "month");
- Assert.False(yearText.Text == "year");
+ Assert.NotNull(dayText.Text);
+ Assert.NotNull(monthText.Text);
+ Assert.NotNull(yearText.Text);
Assert.False(datePicker.Classes.Contains(":hasnodate"));
datePicker.SelectedDate = null;
- Assert.True(dayText.Text == "day");
- Assert.True(monthText.Text == "month");
- Assert.True(yearText.Text == "year");
+ Assert.Null(dayText.Text);
+ Assert.Null(monthText.Text);
+ Assert.Null(yearText.Text);
Assert.True(datePicker.Classes.Contains(":hasnodate"));
}
}
diff --git a/tests/Avalonia.Controls.UnitTests/TimePickerTests.cs b/tests/Avalonia.Controls.UnitTests/TimePickerTests.cs
index f84a6a5791..d098dcc6f7 100644
--- a/tests/Avalonia.Controls.UnitTests/TimePickerTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/TimePickerTests.cs
@@ -93,12 +93,12 @@ namespace Avalonia.Controls.UnitTests
TimeSpan ts = TimeSpan.FromHours(10);
timePicker.SelectedTime = ts;
- Assert.False(hourText.Text == "hour");
- Assert.False(minuteText.Text == "minute");
+ Assert.NotNull(hourText.Text);
+ Assert.NotNull(minuteText.Text);
timePicker.SelectedTime = null;
- Assert.True(hourText.Text == "hour");
- Assert.True(minuteText.Text == "minute");
+ Assert.Null(hourText.Text);
+ Assert.Null(minuteText.Text);
}
}