These are chat archives for AvaloniaUI/Avalonia

10th
Jul 2016
Miguel Rochefort
@miguelrochefort
Jul 10 2016 03:54
Is Avalonia compatible
with UWP?
Is there any reason why the API's differ from UWP?
Wouldn't you get all the documentation, visual tree explorer, designer for free?
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 03:59
Avalonia can be used in a UWP app that uses DirectX.
The APIs differ for a few reasons. Main one being that this project was started before UWP was released.
Miguel Rochefort
@miguelrochefort
Jul 10 2016 04:09
Are the APIs compatible with WPF?
Can I build a WPF app, and run it on iOS?
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:15
They are very similar to WPF, but redesigned to take advantage of newer C# features.
Miguel Rochefort
@miguelrochefort
Jul 10 2016 04:18
Does it make sense to break compatibility just for these features?
Also, I was wondering if it supported the ability to nest native controls on iOS and Android.
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:27
WPF is also not architected to be cross platform.
I've realized while working on Avalonia how much of WPF's rendering api is basically C# surfacing of DirectX
Miguel Rochefort
@miguelrochefort
Jul 10 2016 04:30
Can you give an example of what makes WPF not architectures or cross platform?
I still can't tell if it's compatible with native iOS controls or not
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:32
The set of options available in WPF for some rendering operations are 1-to-1 comparisons to DirectX options (that aren't available on other platforms).
Currently you can't nest native iOS controls in Avalonia. I'm not sure if thats on our roadmap, but it might be at some point.
Steven Kirk
@grokys
Jul 10 2016 04:35
@miguelrochefort initially i started trying to implement WPF's API: https://github.com/grokys/Avalonia
however, i wasn't enjoying it - WPF's API sucks in many places
this was back when i was doing all this for my own enjoyment and learning
i didn't realise it'd actually become usable
;)
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:37
I can personally say that I like Avalonia's API design.
Steven Kirk
@grokys
Jul 10 2016 04:37
but - if i'd had to follow WPF's API, I can guarantee we wouldn't be at this stage
i would've given up years ago
@jkoritzinsky thanks! i think it's better in general. always stuff that can be improved though
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:38
Very true!
Steven Kirk
@grokys
Jul 10 2016 04:38
but anyway - so the reason it doesn't follow WPF's API are purely selfish ;)
i think that's a good enough reason ;)
if you want to see what i mean - try to reverse engineer WPF's CollectionViews without looking at the source
their API is completely bizzare
actually - i've got a WPF WTF document from those days
WPF WTF
-------

General

- Still no way to easily auto-select text box contents when gets focus.
- Form layouts are a pain.
- Doing simple not or add/subtract in value converters is a pain.
- You can only set event triggers directly on the Trigger property.
- BasedOn="{StaticResource {x:Type Button}}" -- eurgh
- Can't bind data grid column properties.
- Multiple selection is a hack.

Implementation

- ApplyTemplate is defined in UIElement but templates are only introduced in Control, however ApplyTemplate is not virtual.
- LogicalChildren returns an IEnumerator instead of an IEnumerable.
- UIElementCollection calls UIEleement.Add/RemoveLogicalChild directly instead of proving callbacks. Coupling!
- LogicalChildren is virtual, whereas Add/RemoveLogicalChild are not.
- Mutating structs.
- VisualCollection.GetEnumerator returns concrete type VisualCollection.Enumerator.
- TemplateKey.TemplateType defines two values, one of which was always obsolete.
- Control.Padding and Border.Padding are completely separate properties, no AddOwner
- Why exactly can't we get ActualWidth/Height of a visual? It's in there, in RenderSize.
- How fucking difficult it is to save an image.
- How fucking difficult it is to get an image's pixels (how do you work out Stride?)
- Why not just a virtual property instead of DefaultStyleKeyProperty.OverrideMetadata(typeof(TextBox), new FrameworkPropertyMetadata(typeof(TextBox)));
- CollectionView. OH MY GOD.
- Setting Selector.SelectedItem to invalid value retains selection, doing the same on SelectedValue clears selection.
Steven Kirk
@grokys
Jul 10 2016 04:44
LogicalChildren returns an IEnumerator instead of an IEnumerable
let that sink in
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:49
WPF is all sorts of screwed up sometimes.
Steven Kirk
@grokys
Jul 10 2016 04:53
In fairness partly because it's pre c#1
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 04:58
That's about right.
Johan Larsson
@JohanLarsson
Jul 10 2016 07:17
why is BasedOn="{StaticResource {x:Type Button}}" bad?
slightly verbose but there are much worse examples if that is what you mean
All the internal stuff in wpf is pretty high on my wtf list.
Johan Larsson
@JohanLarsson
Jul 10 2016 07:25
another gem is binding to actual width of ColumnDefinition it is there but does no notify
wpf is a thousand papercuts, it is fun until it is not :)
great ideas and poor implementation in places sums it up well I think
I believe this works for select all text on focus
Johan Larsson
@JohanLarsson
Jul 10 2016 07:30
one medium sized wtf is that using eventmanager.registerclasshandler for loaded only works for some controls
Nikita Tsukanov
@kekekeks
Jul 10 2016 07:43

has accessibility at all been considered when writing this cross-platform toolkit

We'll need to provide metadata for screenreader

That's doable but won't be implemented until release, I think
Johan Larsson
@JohanLarsson
Jul 10 2016 07:44
another wtf is that readonly dps can't be bound onewaytosource
Nikita Tsukanov
@kekekeks
Jul 10 2016 07:47

one nice side effect of accessibility is that it enables UI-tests

For UI tests we need a "headless" windowing platform implementation. We are currently using something like that for internal tests in avalonia

Gaurav Gogia
@DesmondANIMUS
Jul 10 2016 09:03

Hi all, I would like to join this project. I have been developing in C# since last month. Completed two independent projects. One on WPF and other on UWP platform.

WPF one was based on offline database and UWP was on online database (did not make backend for this one)

Do I need more experience / knowledge before I can join ??

Thanks ^_^

Wiesław Šoltés
@wieslawsoltes
Jul 10 2016 09:30
@jkoritzinsky I have submitted PR #586 including some fixes for failing appveyor CI after migration to Rx 3.0 and updates to NuGet packages
Steven Kirk
@grokys
Jul 10 2016 13:49
@wieslawsoltes travis is still failing on that PR it seems
Maybe you guys know ^
Steven Kirk
@grokys
Jul 10 2016 14:11
i don't see how even wpf would know that
Johan Larsson
@JohanLarsson
Jul 10 2016 14:11
the binding knows
maybe it does not remember :)
but it does the transfer
Steven Kirk
@grokys
Jul 10 2016 14:22
so when you say "user input" you just mean "not from a binding" rather than user input?
as "not from a binding" can mean many things: setting the property via code for example
Johan Larsson
@JohanLarsson
Jul 10 2016 14:22
yeah, I worded it poorly
<TextBox Text="{Binding Foo}" />
if it was the source or the target that updated the value last
or something else like setting it in code or animation etc
Johan Larsson
@JohanLarsson
Jul 10 2016 14:29
I have solved this once but it was a mess and not a general solution
Wiesław Šoltés
@wieslawsoltes
Jul 10 2016 15:00

@wieslawsoltes travis is still failing on that PR it seems

@grokys This is issue with mono/TravisCI :( but merged PR is building fine on master branch.

This was causing exception when run under mono AvaloniaUI/Avalonia@8eebf73
Steven Kirk
@grokys
Jul 10 2016 15:01
Hmm strange, so branches aren't building but master is?
We need to file a mono bug about that!
Wiesław Šoltés
@wieslawsoltes
Jul 10 2016 15:02
This time the issue was that console test runner got stuck and TravisCI timeout the build after 10min, this happens sometimes for not apparent reason
Steven Kirk
@grokys
Jul 10 2016 15:02
Right yeah I saw that was the problem. It's just random?
Wiesław Šoltés
@wieslawsoltes
Jul 10 2016 15:03
Sometimes
you can force longer timeouts but this does not help really
Steven Kirk
@grokys
Jul 10 2016 15:33
@JohanLarsson that's something that's not exposed currently in avalonia, though we can expose it
Johan Larsson
@JohanLarsson
Jul 10 2016 15:33
ah, could be nice I think
The need comes up every now and then for me when writing controls.
Miguel Rochefort
@miguelrochefort
Jul 10 2016 15:43
@grokys I've been reimplementing UWP APIs for 2 years now. It's very close to WPF, although a lot of things are now internal (which makes it less powerful). I agree with you about CollectionView, I have not been able to understand how it works.
I also had some trouble reverse engineering touch handling and focus, but that's clear now.
Johan Larsson
@JohanLarsson
Jul 10 2016 15:51
I think there is a comment in the collectionview source saying that it is broken :)
Johan Larsson
@JohanLarsson
Jul 10 2016 16:10
@grokys potentially useful for stuff like undo & validation
Steven Kirk
@grokys
Jul 10 2016 16:58
@DesmondANIMUS it might be a little hard to get started on avalonia after 1 month of C# but one way you could really help out is by trying to learn it by asking questions here and writing e.g. blog posts about what you find out
that way you learn the framework and help others too
once you know where you are a little more, you can maybe take a look at the "up for grabs" issues https://github.com/AvaloniaUI/Avalonia/issues?q=is%3Aopen+is%3Aissue+label%3Aup-for-grabs and try fixing some of them
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:00
WPF is what, more than 10 year old now?
Johan Larsson
@JohanLarsson
Jul 10 2016 17:00
ten years since anything changed :D
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:00
Any plan to create a more modern framework?
Johan Larsson
@JohanLarsson
Jul 10 2016 17:01
modern is crap like electron I think
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:01
Seems like we should have learned a lot since then.
Hmmm
I mean, the natural evolution of WPF
Johan Larsson
@JohanLarsson
Jul 10 2016 17:01
where even the most trivial app uses 2GB of ram :)
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:02
Does it make sense to have both events and DPs?
Does it make sense that DPs are not IObservable?
Johan Larsson
@JohanLarsson
Jul 10 2016 17:02
I don't expect much to happen with wpf given 1) low quality code 2) large number of users
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:03
Does it make sense to have different ways to declare reactive/bindable properties in the View and in the ViewModel?
I'm talking about Avalonia. Since it's breaking compatibility with WPF, it has the potential to do a lot more.
Johan Larsson
@JohanLarsson
Jul 10 2016 17:04
I hope m$ will have to bite the bullet and start with code transforms
roslyn should be nice for that
undo language and library features
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:04
Code transforms?
Johan Larsson
@JohanLarsson
Jul 10 2016 17:37
say you have a typo in a lib and fix it
instead of being a breaking change you could ship a transform that corrected the typo in the code using your lib
maybe there is another word for it idk
Darnell Williams
@Seeker1437
Jul 10 2016 17:55
I feel like that is a good word
Miguel Rochefort
@miguelrochefort
Jul 10 2016 17:59
A deferred rename that works across projects? Interesting.
Johan Larsson
@JohanLarsson
Jul 10 2016 17:59
I have only read about it, think go have used it.
@miguelrochefort more like a code fix that you ship with versions that have breaking changes
nontrivial for sure but huge upside if correcting old smells becomes possible
Darnell Williams
@Seeker1437
Jul 10 2016 18:02
It extremely loosely reminds me of a binding redirect
Johan Larsson
@JohanLarsson
Jul 10 2016 18:07
wpf would be nice if it was written today as open source
no one would have dared to pr some of the stuff in the framework if the world could see it :D
dunno how m$ writes code but I imagine they have many meetings etc.
Johan Larsson
@JohanLarsson
Jul 10 2016 18:12
code looks like waterfall
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 18:26
MS used to do waterfall but nowadays they've switched to an agile/scrum combo on most of not all teams.
Johan Larsson
@JohanLarsson
Jul 10 2016 18:26
do you work at m$?
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 18:49
I'm interning there this summer.
Johan Larsson
@JohanLarsson
Jul 10 2016 18:53
nice
Nikita Tsukanov
@kekekeks
Jul 10 2016 19:18

Does it make sense that DPs are not IObservable?

In avalonia DPs are IObservable, for the record

So we can just retarget PCL projects
nice
Jeremy Koritzinsky
@jkoritzinsky
Jul 10 2016 21:52