18 changed files with 207 additions and 49 deletions
@ -0,0 +1,37 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="IObservablePropertyBag.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
namespace Perspex |
|||
{ |
|||
using System; |
|||
|
|||
/// <summary>
|
|||
/// Interface for getting/setting <see cref="PerspexProperty"/> bindings on an object.
|
|||
/// </summary>
|
|||
public interface IObservablePropertyBag : IPropertyBag |
|||
{ |
|||
/// <summary>
|
|||
/// Binds a <see cref="PerspexProperty"/> to an observable.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <param name="source">The observable.</param>
|
|||
/// <param name="priority">The priority of the binding.</param>
|
|||
/// <returns>
|
|||
/// A disposable which can be used to terminate the binding.
|
|||
/// </returns>
|
|||
IDisposable Bind( |
|||
PerspexProperty property, |
|||
IObservable<object> source, |
|||
BindingPriority priority = BindingPriority.LocalValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets an observable for a <see cref="PerspexProperty"/>.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <returns>An observable.</returns>
|
|||
IObservable<object> GetObservable(PerspexProperty property); |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="IPropertyBag.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
namespace Perspex |
|||
{ |
|||
/// <summary>
|
|||
/// Interface for getting/setting <see cref="PerspexProperty"/> values on an object.
|
|||
/// </summary>
|
|||
public interface IPropertyBag |
|||
{ |
|||
/// <summary>
|
|||
/// Clears a <see cref="PerspexProperty"/>'s local value.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
void ClearValue(PerspexProperty property); |
|||
|
|||
/// <summary>
|
|||
/// Gets a <see cref="PerspexProperty"/> value.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <returns>The value.</returns>
|
|||
object GetValue(PerspexProperty property); |
|||
|
|||
/// <summary>
|
|||
/// Checks whether a <see cref="PerspexProperty"/> is registered on this object.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <returns>True if the property is registered, otherwise false.</returns>
|
|||
bool IsRegistered(PerspexProperty property); |
|||
|
|||
/// <summary>
|
|||
/// Checks whether a <see cref="PerspexProperty"/> is set on this object.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <returns>True if the property is set, otherwise false.</returns>
|
|||
bool IsSet(PerspexProperty property); |
|||
|
|||
/// <summary>
|
|||
/// Sets a <see cref="PerspexProperty"/> value.
|
|||
/// </summary>
|
|||
/// <param name="property">The property.</param>
|
|||
/// <param name="value">The value.</param>
|
|||
/// <param name="priority">The priority of the value.</param>
|
|||
void SetValue(PerspexProperty property, object value, BindingPriority priority = BindingPriority.LocalValue); |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
// -----------------------------------------------------------------------
|
|||
// <copyright file="GlobalSuppressions.cs" company="Steven Kirk">
|
|||
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|||
// </copyright>
|
|||
// -----------------------------------------------------------------------
|
|||
|
|||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( |
|||
"StyleCop.CSharp.MaintainabilityRules", |
|||
"SA1401:Fields must be private", |
|||
Justification = "PerspexProperty fields should not be private.")] |
|||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( |
|||
"StyleCop.CSharp.DocumentationRules", |
|||
"SA1609:Property documentation must have value", |
|||
Justification = "This rule is fscking pointless")] |
|||
Loading…
Reference in new issue