csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
52 lines
1.7 KiB
// Copyright (c) The Avalonia Project. All rights reserved.
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
using Avalonia.Data;
|
|
|
|
namespace Avalonia
|
|
{
|
|
/// <summary>
|
|
/// Base class for avalonia property metadata.
|
|
/// </summary>
|
|
public class PropertyMetadata
|
|
{
|
|
private BindingMode _defaultBindingMode;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="PropertyMetadata"/> class.
|
|
/// </summary>
|
|
/// <param name="defaultBindingMode">The default binding mode.</param>
|
|
public PropertyMetadata(
|
|
BindingMode defaultBindingMode = BindingMode.Default)
|
|
{
|
|
_defaultBindingMode = defaultBindingMode;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the default binding mode for the property.
|
|
/// </summary>
|
|
public BindingMode DefaultBindingMode
|
|
{
|
|
get
|
|
{
|
|
return _defaultBindingMode == BindingMode.Default ?
|
|
BindingMode.OneWay : _defaultBindingMode;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Merges the metadata with the base metadata.
|
|
/// </summary>
|
|
/// <param name="baseMetadata">The base metadata to merge.</param>
|
|
/// <param name="property">The property to which the metadata is being applied.</param>
|
|
public virtual void Merge(
|
|
PropertyMetadata baseMetadata,
|
|
AvaloniaProperty property)
|
|
{
|
|
if (_defaultBindingMode == BindingMode.Default)
|
|
{
|
|
_defaultBindingMode = baseMetadata.DefaultBindingMode;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|