mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Data bindings - Further implemented default converters
This commit is contained in:
1 parent
5972e148ee
commit
237f8b8eea
21 files changed
+447
-257
No files matched your search
@@ -32,7 +32,7 @@ namespace Artemis.Core
|
||||
get => _baseValue;
|
||||
set
|
||||
{
|
||||
if (value.GetType() != GetPropertyType())
|
||||
if (value != null && value.GetType() != GetPropertyType())
|
||||
throw new ArtemisCoreException("Cannot update base value because of a type mismatch");
|
||||
_baseValue = value;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace Artemis.Core
|
||||
get => _currentValue;
|
||||
set
|
||||
{
|
||||
if (value.GetType() != GetPropertyType())
|
||||
if (value != null && value.GetType() != GetPropertyType())
|
||||
throw new ArtemisCoreException("Cannot update current value because of a type mismatch");
|
||||
_currentValue = value;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace Artemis.Core
|
||||
get => _defaultValue;
|
||||
set
|
||||
{
|
||||
if (value.GetType() != GetPropertyType())
|
||||
if (value != null && value.GetType() != GetPropertyType())
|
||||
throw new ArtemisCoreException("Cannot update default value because of a type mismatch");
|
||||
_defaultValue = value;
|
||||
}
|
||||
@@ -186,6 +186,9 @@ namespace Artemis.Core
|
||||
/// <returns>The newly created data binding</returns>
|
||||
public DataBinding EnableDataBinding(DataBindingRegistration dataBindingRegistration)
|
||||
{
|
||||
if (dataBindingRegistration.LayerProperty != this)
|
||||
throw new ArtemisCoreException("Cannot enable a data binding using a data binding registration of a different layer property");
|
||||
|
||||
var dataBinding = new DataBinding(dataBindingRegistration);
|
||||
_dataBindings.Add(dataBinding);
|
||||
|
||||
|
||||
Reference in new issue
Block a user