|
|
@ -34,38 +34,27 @@ namespace Avalonia |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public bool IsSet(AvaloniaProperty property) |
|
|
public bool IsSet(AvaloniaProperty property) |
|
|
{ |
|
|
|
|
|
return TryGetValueUntyped(property, out _); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public bool TryGetValue<T>(StyledPropertyBase<T> property, out T value) |
|
|
|
|
|
{ |
|
|
{ |
|
|
if (_values.TryGetValue(property, out var slot)) |
|
|
if (_values.TryGetValue(property, out var slot)) |
|
|
{ |
|
|
{ |
|
|
if (slot is IValue<T> v) |
|
|
if (slot is IValue v) |
|
|
{ |
|
|
{ |
|
|
if (v.Value.HasValue) |
|
|
return v.Value.HasValue; |
|
|
{ |
|
|
|
|
|
value = v.Value.Value; |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
value = (T)slot; |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
value = default!; |
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public bool TryGetValueUntyped(AvaloniaProperty property, out object? value) |
|
|
public bool TryGetValue<T>(StyledPropertyBase<T> property, out T value) |
|
|
{ |
|
|
{ |
|
|
if (_values.TryGetValue(property, out var slot)) |
|
|
if (_values.TryGetValue(property, out var slot)) |
|
|
{ |
|
|
{ |
|
|
if (slot is IValue v) |
|
|
if (slot is IValue<T> v) |
|
|
{ |
|
|
{ |
|
|
if (v.Value.HasValue) |
|
|
if (v.Value.HasValue) |
|
|
{ |
|
|
{ |
|
|
@ -75,12 +64,12 @@ namespace Avalonia |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
value = slot; |
|
|
value = (T)slot; |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
value = default; |
|
|
value = default!; |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|