Nikita Tsukanov
0b756d0b8a
More null checks
9 years ago
Steven Kirk
c9e90fd7fc
Fix type conversions.
They were not correct before. Also clarified the two types of
conversions:
- `TryConvertImplicit` implements the implicit conversions allowed by
the C# language
- `TryConvert` tries every means at its disposal to convert a value to a
type
`AvaloniaObject` uses only implicit conversions. This allows one to
write:
```
var control = new TextBlock
{
[Canvas.TopProperty] = 10
}
```
Without implicit conversions, this would fail because `Canvas.Top` is a
`double` whereas `10` is an `int`, however only implicit conversions
should be used here, otherwise the following would pass, which is
probably not what would be wanted:
```
var control = new TextBlock
{
[TextBlock.TextProperty] = observable, // Text is now the type name of
`observable`
}
```
`DefaultValueConverter` uses `TryConvert`, i.e. every conversion
possible.
Fixes #972 .
9 years ago
Steven Kirk
a46be4e200
Ensure correct thread for AvaloniaProperty access.
Previously we ensured that `AvaloniaObject.SetValue` was run on the main
thread. This makes sure that `GetValue`, `IsSet` and `ClearValue` are
also run on the main thread. Unit testing this turned out to be more
complicated than expected, because `Dispatcher` keeps a hold of a
reference to the first `IPlatformThreadingInterface` it sees, so made
`UnitTestApplication` able to notify `Dispatcher` that it should update
its services.
9 years ago
Jeremy Koritzinsky
3640d4dc1b
Implemented optimization to only construct a dictionary for priority levels if there is more than one in use. This drops memory consumption in most applications by a reasonable amount since most don't use multiple bindings on single properties (like animation and a local binding).
10 years ago
Steven Kirk
c9d3408c29
Improve numerical binding error messages.
10 years ago
Steven Kirk
a560c3b6d3
Use WeakReference in BindingNotification.
So that it doesn't keep objects alive when cached by
`.Publish().RefCount()` in `ExpressionObserver`. Added a leak test to
test that.
10 years ago
Steven Kirk
06b0d15fc2
Surface BindingNotifications in AvaloniaObject.
10 years ago
Steven Kirk
4fe2a3d86c
Removed vestiges of old data validation.
10 years ago
Steven Kirk
0d4a613580
Updated some docs.
And simplified a bit of failing test code.
10 years ago
Steven Kirk
abdbcac79d
Added BindingNotification.
This will replace BindingError and IValidationStatus for bindings that want to notify binding/validation errors. Still WIP.
10 years ago
Steven Kirk
5c33fbc6ee
Reimplemented property validation.
As far as it was in `property-validation-grokys` branch. Things were
messed up on master so had to merge this manually so may be problems.
10 years ago
Steven Kirk
5be41985c3
Renamed Perspex -> Avalonia
10 years ago
Jeremy Koritzinsky
da5fd06fcd
Moved validation filtering into ExpressionObserver and out of InstancedBinding, PerspexObject, and the Priority* system. Renamed some methods in this system to be more descriptive.
10 years ago
Jeremy Koritzinsky
774c6e6fa4
Made validation enable-able during binding construction, similar to WPF. Now validation events are only raised when the validation type is enabled on the property.
10 years ago
Jeremy Koritzinsky
ee486113e5
Finished wiring up validation support. Now exceptions and INotifyDataErrorInfo implementers will set controls into their ":invalid" pseudo-class state.
10 years ago
Steven Kirk
7b371f8d2d
Give PriorityLevel a reference to its PriorityValue.
And directly call the LevelValueChanged method on it rather than using callbacks.
10 years ago
Steven Kirk
c984a504a2
Change the way PriorityValue notifies.
Directly call a Changed method on the PriorityValue owner rather than using an observable.
10 years ago
Steven Kirk
87fa632707
Removed LevelPrecedenceMode.
You should use direct properties if you want Latest mode.
10 years ago
Steven Kirk
3bb9fe0b58
Added BindingError class.
10 years ago
Steven Kirk
ea6b1d4cfd
Starting removing hard dependency on Serilog.
Instead log through a static Logger, and provide a Serilog consumer for
this.
10 years ago
Steven Kirk
5773704f2d
Started updating DevTools to use XAML.
10 years ago
Steven Kirk
14507beb41
Log invalid binding values in PriorityValue.
10 years ago
Steven Kirk
9e8fec942e
Log invalid binding values in PriorityValue.
10 years ago
Steven Kirk
16825ac45e
Handle null and UnsetValue in ExpressionSubject.
11 years ago
Steven Kirk
ed4f46a6cf
Don't throw when binding produces invalid value.
11 years ago
Steven Kirk
247831a6c8
Implemented direct PersexProperties.
11 years ago
Nikita Tsukanov
3cd3579475
"field can be readonly"
11 years ago
Nikita Tsukanov
21a3554260
Change property getter to expression properties
11 years ago
Nikita Tsukanov
01e2c90bc5
Removed this.
11 years ago
Steven Kirk
145411020b
Ran .net core code formatter.
11 years ago
Steven Kirk
6151aef188
Removed file headers.
11 years ago
Steven Kirk
6167bacf54
Moved to more standard filesystem layout.
Based on https://gist.github.com/davidfowl/ed7564297c61fe9ab814 and https://github.com/fsprojects/ProjectScaffold
11 years ago
Steven Kirk
1599828f9d
Documentation.
11 years ago
Steven Kirk
aa147f0423
More stylecoping.
11 years ago
Steven Kirk
ee8c211683
Renamed PerpexProperty coercion as validation.
As it can be used to invalidate a property change by throwing an
exception as well as coerce the value.
11 years ago
Steven Kirk
26015acfd9
Handle implicit conversions in perspex properties.
Fixes #49 .
11 years ago
Steven Kirk
3c423fee5e
Updated doc comments.
11 years ago
Steven Kirk
d558bd27e6
Handle null values.
11 years ago
Steven Kirk
df77302d94
Another tweak to the binding system.
Binding levels with a an even number priority use the last fired binding
for the current value, those with odd number priorities use the latest
added.
11 years ago
Steven Kirk
8d7d04ffd3
Added diagnostic popup to devtools.
11 years ago
Steven Kirk
fe6e021cb5
Make PriorityValue internal.
Want to add computed/readonly values in the near future which will not
use PriorityValue.
11 years ago
Steven Kirk
aef34f810d
Stylecop fixes.
11 years ago
Steven Kirk
a4c88ca764
Reworked bindings.
Now, two way bindings work as expected and setting a local value on a
property with a binding sets the value temporarily until the binding
changes value.
11 years ago
Steven Kirk
688f6532c8
Added coercion to PerspexProperties.
And use it to make sure ScrollViewer's offset is in range.
12 years ago
Steven Kirk
bfadaac5d9
Non-building checkpoint in MAJOR refactor.
12 years ago
Steven Kirk
8e7be781f8
Implemented two-way binding.
And hooked up the TreeViewItem's expander button. The hit testing on it
is a bit off though...
12 years ago
Steven Kirk
c9ee3847ce
TreeView work in progress...
12 years ago
Steven Kirk
454393b71a
Added TabControl.
12 years ago
Steven Kirk
37d29816fb
Added a diagnostic to print the visual tree.
12 years ago
Steven Kirk
d680fdb76d
Stylecop fixes
12 years ago