Browse Source

Merge branch 'master' into fixes/code_documentation

pull/6138/head
Max Katz 5 years ago
committed by GitHub
parent
commit
72d38d2ca3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      src/Avalonia.Controls/Application.cs
  2. 6
      src/Avalonia.Controls/MenuItem.cs

31
src/Avalonia.Controls/Application.cs

@ -13,6 +13,7 @@ using Avalonia.Platform;
using Avalonia.Rendering; using Avalonia.Rendering;
using Avalonia.Styling; using Avalonia.Styling;
using Avalonia.Threading; using Avalonia.Threading;
#nullable enable
namespace Avalonia namespace Avalonia
{ {
@ -35,27 +36,27 @@ namespace Avalonia
/// <summary> /// <summary>
/// The application-global data templates. /// The application-global data templates.
/// </summary> /// </summary>
private DataTemplates _dataTemplates; private DataTemplates? _dataTemplates;
private readonly Lazy<IClipboard> _clipboard = private readonly Lazy<IClipboard> _clipboard =
new Lazy<IClipboard>(() => (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard))); new Lazy<IClipboard>(() => (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard)));
private readonly Styler _styler = new Styler(); private readonly Styler _styler = new Styler();
private Styles _styles; private Styles? _styles;
private IResourceDictionary _resources; private IResourceDictionary? _resources;
private bool _notifyingResourcesChanged; private bool _notifyingResourcesChanged;
private Action<IReadOnlyList<IStyle>> _stylesAdded; private Action<IReadOnlyList<IStyle>>? _stylesAdded;
private Action<IReadOnlyList<IStyle>> _stylesRemoved; private Action<IReadOnlyList<IStyle>>? _stylesRemoved;
/// <summary> /// <summary>
/// Defines the <see cref="DataContext"/> property. /// Defines the <see cref="DataContext"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<object> DataContextProperty = public static readonly StyledProperty<object?> DataContextProperty =
StyledElement.DataContextProperty.AddOwner<Application>(); StyledElement.DataContextProperty.AddOwner<Application>();
/// <inheritdoc/> /// <inheritdoc/>
public event EventHandler<ResourcesChangedEventArgs> ResourcesChanged; public event EventHandler<ResourcesChangedEventArgs>? ResourcesChanged;
public event EventHandler<UrlOpenedEventArgs> UrlsOpened; public event EventHandler<UrlOpenedEventArgs>? UrlsOpened;
/// <summary> /// <summary>
/// Creates an instance of the <see cref="Application"/> class. /// Creates an instance of the <see cref="Application"/> class.
@ -72,7 +73,7 @@ namespace Avalonia
/// The data context property specifies the default object that will /// The data context property specifies the default object that will
/// be used for data binding. /// be used for data binding.
/// </remarks> /// </remarks>
public object DataContext public object? DataContext
{ {
get { return GetValue(DataContextProperty); } get { return GetValue(DataContextProperty); }
set { SetValue(DataContextProperty, value); } set { SetValue(DataContextProperty, value); }
@ -162,7 +163,7 @@ namespace Avalonia
/// <summary> /// <summary>
/// Gets the styling parent of the application, which is null. /// Gets the styling parent of the application, which is null.
/// </summary> /// </summary>
IStyleHost IStyleHost.StylingParent => null; IStyleHost? IStyleHost.StylingParent => null;
/// <inheritdoc/> /// <inheritdoc/>
bool IStyleHost.IsStylesInitialized => _styles != null; bool IStyleHost.IsStylesInitialized => _styles != null;
@ -194,7 +195,7 @@ namespace Avalonia
public virtual void Initialize() { } public virtual void Initialize() { }
/// <inheritdoc/> /// <inheritdoc/>
bool IResourceNode.TryGetResource(object key, out object value) bool IResourceNode.TryGetResource(object key, out object? value)
{ {
value = null; value = null;
return (_resources?.TryGetResource(key, out value) ?? false) || return (_resources?.TryGetResource(key, out value) ?? false) ||
@ -279,17 +280,17 @@ namespace Avalonia
NotifyResourcesChanged(e); NotifyResourcesChanged(e);
} }
private string _name; private string? _name;
/// <summary> /// <summary>
/// Defines Name property /// Defines Name property
/// </summary> /// </summary>
public static readonly DirectProperty<Application, string> NameProperty = public static readonly DirectProperty<Application, string?> NameProperty =
AvaloniaProperty.RegisterDirect<Application, string>("Name", o => o.Name, (o, v) => o.Name = v); AvaloniaProperty.RegisterDirect<Application, string?>("Name", o => o.Name, (o, v) => o.Name = v);
/// <summary> /// <summary>
/// Application name to be used for various platform-specific purposes /// Application name to be used for various platform-specific purposes
/// </summary> /// </summary>
public string Name public string? Name
{ {
get => _name; get => _name;
set => SetAndRaise(NameProperty, ref _name, value); set => SetAndRaise(NameProperty, ref _name, value);

6
src/Avalonia.Controls/MenuItem.cs

@ -36,7 +36,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Defines the <see cref="HotKey"/> property. /// Defines the <see cref="HotKey"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<KeyGesture> HotKeyProperty = public static readonly StyledProperty<KeyGesture?> HotKeyProperty =
HotKeyManager.HotKeyProperty.AddOwner<MenuItem>(); HotKeyManager.HotKeyProperty.AddOwner<MenuItem>();
/// <summary> /// <summary>
@ -108,7 +108,7 @@ namespace Avalonia.Controls
private ICommand? _command; private ICommand? _command;
private bool _commandCanExecute = true; private bool _commandCanExecute = true;
private Popup? _popup; private Popup? _popup;
private KeyGesture _hotkey; private KeyGesture? _hotkey;
private bool _isEmbeddedInMenu; private bool _isEmbeddedInMenu;
/// <summary> /// <summary>
@ -214,7 +214,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Gets or sets an <see cref="KeyGesture"/> associated with this control /// Gets or sets an <see cref="KeyGesture"/> associated with this control
/// </summary> /// </summary>
public KeyGesture HotKey public KeyGesture? HotKey
{ {
get { return GetValue(HotKeyProperty); } get { return GetValue(HotKeyProperty); }
set { SetValue(HotKeyProperty, value); } set { SetValue(HotKeyProperty, value); }

Loading…
Cancel
Save