These are chat archives for AvaloniaUI/Avalonia

25th
Apr 2017
Steven Kirk
@grokys
Apr 25 2017 00:29
yeah :fire: cairo
i don't know if it'd be the right place, but i recently added the Typeface class - would that be a good place to put font metrics?
Nikita Tsukanov
@kekekeks
Apr 25 2017 00:31
Yep, it should be
What are you using it for, BTW?
For passing font information to background thread?
@jkoritzinsky Some examples from your oxyplot port are throwing exceptions, is that intended or they were updated after your PR in incompatible way?
Also demos seem to run very slow
Steven Kirk
@grokys
Apr 25 2017 00:37
just that when i refactored FormattedText i saw that WPF had the Typeface class so I decided that i might as well add it as a way of grouping together a bunch of parameters
Jeremy Koritzinsky
@jkoritzinsky
Apr 25 2017 00:50
I think there were probably some breaking changes on our end that broke them. They were working when I ported them over.
@kekekes and the demos run slow because there was a bug with streaming geometry that wasn't fixed in 0.4.0 so I disabled it. That combined with our current rendering makes it lag like crazy
Nikita Tsukanov
@kekekeks
Apr 25 2017 00:56
It also doesn't seem to work well with netstandard for some reason
But I guess that it's OmniXAML to blame here, since it's the one that's throwing weird exceptions
Nikita Tsukanov
@kekekeks
Apr 25 2017 01:19
Unhandled Exception: OmniXaml.LoadException: Error loading XAML: OmniXaml.ParseException: Cannot find a namespace with the prefix "local"
...
blablabla
...
   at OxyPlot.Avalonia.OxyPlotModule.Initialize()
meh
Doesn't seem to work with the version from master, unfortunately
And Skia backend from 0.4.0 doesn't work with GTK
Nikita Tsukanov
@kekekeks
Apr 25 2017 01:32
Got it working on Mono + Cairo
soerendd
@soerendd
Apr 25 2017 05:13
@kekekeks what kind of project do you want to do with the nanopi? I mean the nanopi doesn't provide a video out. Or do you not need a gui?
Other question. Are animations possible with avalonia? I mean animations defined in xaml. If not are there any plans for that?
Nikita Tsukanov
@kekekeks
Apr 25 2017 07:34
Ehm, it does provide a video out, actually
You can connect a small screen via SPI
soerendd
@soerendd
Apr 25 2017 09:19
Yes, ok you can use gpio and SPI or i2c. Did you used such a spi connected display before? Those small 2.8" or 4" Displays are good for static content. I used a 4" LCD (480x320) with a raspberry pi and connected it via spi in a project. I used a SPI clock of 64MHz. Values above 65 MHz are very unstable (data errors). I could get 17 fps out with that config. For my home automation project which i will start soon i plan to use a rpi with the official 7" display. And i will try to use avalonia for the ui
Nikita Tsukanov
@kekekeks
Apr 25 2017 09:33
@grokys What is the plan about StaticResource support? We only have StyleResource now, I'm not sure if it's the same thing
@soerendd
I've used one with STM32
They are fine for UI
As long as you don't need smooth animations
Steven Kirk
@grokys
Apr 25 2017 09:42
Yeah styleresources are intended to replace static and dynamic resources. We may want to add in wpf style resources too, but I think what we have should be ok. Only problem is that they're not dynamic yet ;) only the static part is implemented
Nikita Tsukanov
@kekekeks
Apr 25 2017 09:51
So I can, for example, do something like
<Window>
   <Window.Styles>
    <Style>
      <Style.Resources>
         <MyConverter x:Key="Converter" Option1="234" Option2="544"/>
      </Style.Resources>
    </Style>
  </Window.Styles>
And reference Converter using StyleResource from markup?
Steven Kirk
@grokys
Apr 25 2017 09:56
yep! that should work i think
usually though i just add a static MyConverter.Instance { get; } property and use {Static} from the binding though
Steven Kirk
@grokys
Apr 25 2017 10:01
but obviously you can't do that if you have parameters
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:19
Width="{Binding Width, Converter={StyleResource CellToScreenConverter}, Mode=OneWay}"
System.InvalidOperationException: Cannot assign to 'Converter' on 'Avalonia.Markup.Xaml.MarkupExtensions.BindingExtension
Am I doing something wrong?
Works fine with {Static}
Steven Kirk
@grokys
Apr 25 2017 10:23
ah yeah looks like that doesn't work yet :(
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:23
Do we have ItemTemplateSelector?
Steven Kirk
@grokys
Apr 25 2017 10:23
AvaloniaUI/Avalonia#818
not, but you can get the same effect as a DataTemplateSelector by implementing a IDataTemplate or using FuncDataTemplate<> and adding it to the DataTemplates
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:34
Oh, so we are using DataTemplates instead of resources
works for me
Steven Kirk
@grokys
Apr 25 2017 10:39
yeah, we'll probably need to make some improvements there, i'm not sure how people use ItemTemplateSelector - i always end up selecting on type so i've never needed it
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:39
I have a custom template selector that can use interfaces
for WPF
Steven Kirk
@grokys
Apr 25 2017 10:40
yeah our DataTemplate can select on interfaces out of the box
only problem is with generics
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:41
For some reason templates doesn't get applied
Once I add anything there ItemsControl becomes empty
Steven Kirk
@grokys
Apr 25 2017 10:42
hmm, do you have something i can look at?
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:43
Fixed it, for some reason I was using Type instead of x:Type
Steven Kirk
@grokys
Apr 25 2017 10:45
yeah i think we need to move to portablexaml
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:45
Mkay, how do I set properties on ContentPresenter?
WPF has ItemContainerStyle for that purpose
Steven Kirk
@grokys
Apr 25 2017 10:45
@donandren what's the progress on #916?
just do a style that selects the ContentPresenter i think
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:47
ItemsControl > ContentPresenter?
Steven Kirk
@grokys
Apr 25 2017 10:47
Yeah i think that should work
need to add documentation for this stuff
Andrey Kunchev
@donandren
Apr 25 2017 10:49
@grokys i think it's ready as functionality everything worked smooth, but when i merged the new projects system my VS studio 2017 works so slow that i've abandoned it weaks ago
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:49
Bindings doesn't work with that
Steven Kirk
@grokys
Apr 25 2017 10:49
even i'm forgetting it, which isn't a good sign
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:49
I can't bind to a property of the item from the style
Steven Kirk
@grokys
Apr 25 2017 10:49
ah yeah @donandren i feel your pain - it's pretty much put a stop to my development on avalonia too
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:50
I guess ContentPresenter doesn't have a proper datacontext or something
Steven Kirk
@grokys
Apr 25 2017 10:50
hmm, let me check
Andrey Kunchev
@donandren
Apr 25 2017 10:50
@grokys this weekend i Can try merge master and try again, i'm even considering making a VS.2015 compatible project for every project in order to work in workable speed untill vs 2017 is fixed
Steven Kirk
@grokys
Apr 25 2017 10:51
well hopefully there'll be a new VS version out in a few weeks, fingers crossed that it fixes the problems
Andrey Kunchev
@donandren
Apr 25 2017 10:51
@grokys are you ok with that so i'll make *.2015.csproj for every project and 2015.sln so at least i ahve chanse to work
Steven Kirk
@grokys
Apr 25 2017 10:51
yeah sure!
Andrey Kunchev
@donandren
Apr 25 2017 10:51
i'm really annoyed with sdk project system speed
Steven Kirk
@grokys
Apr 25 2017 10:51
yeah, it was supposed to be faster!
Andrey Kunchev
@donandren
Apr 25 2017 10:51
with old csproj format vs2017 is working as a charm
Steven Kirk
@grokys
Apr 25 2017 10:52
yep, glad it's not just me. nobody seemed to believe me.
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:52
Mkay, it somehow have fixed itself
Steven Kirk
@grokys
Apr 25 2017 10:52
VS2017 can't even keep up with my typing at times
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:53
The rendering order is different from WPF for some reason
Andrey Kunchev
@donandren
Apr 25 2017 10:53
@grokys you can expect begin of the next weak everythign to be ready with portable.xaml
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:54

nobody seemed to believe me.

It seems to be tons of M$ fanboys on the internet

who outright refuse that anything with VS is wrong
Andrey Kunchev
@donandren
Apr 25 2017 10:56
until VS2017 sdk project issues are fixed the only way i can think of to make some work for avalonia is having parallel 2015 style project for dev and sdk for the build
Nikita Tsukanov
@kekekeks
Apr 25 2017 10:57
Extension development for VS2017 is a bit nightmarish, both instances just freeze for minutes
Johan Larsson
@JohanLarsson
Apr 25 2017 10:57
I think that is true for all versions.
The nightmarish part.
Steven Kirk
@grokys
Apr 25 2017 10:59
The rendering order is different from WPF for some reason
what do you mean by this?
i've heard that if you have only SDK projects in a solution it's not slow
maybe we should try converting all our projects to SDK projects?
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:00
Well, I have canvas as a panel for ItemsControl
And for some reason items that should be on top (they come last in collection) aren't rendered on top
Steven Kirk
@grokys
Apr 25 2017 11:03
hmm, is there any order you can see or are they in random order? do they change order?
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:06
The order of items inside ItemsControl seem to be OK
Steven Kirk
@grokys
Apr 25 2017 11:07
if you inspect in devtools in the visual tree are they in the wrong order?
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:09
Nope, they aren't
The order in the visual tree in fine
Even Ctrl+Shift selects the right element
Using keyboard move up
You will see, that player's tile get overdrawn with terrain
But that happens only in particular cells for some weird reason
Steven Kirk
@grokys
Apr 25 2017 11:14
oh wow it's a game!
:D
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:15
That's happens both with Skia and Direct2D
Steven Kirk
@grokys
Apr 25 2017 11:15
hmm yeah i see it. so it's a problem with the renderer obviously
soerendd
@soerendd
Apr 25 2017 11:17
@kekekeks On my W10 Creators Update it raises an exception
Unbehandelte Ausnahme: System.InvalidOperationException: Die Sequenz enthält keine Elemente.
bei System.Linq.Enumerable.FirstTSource
bei Avalonia.AppBuilder.UsePlatformDetect()
bei PekaCity.App.Main(String[] args)
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:18
Yeah, direct2d initialization is failing from time to time
Can't pin down the issue
Steven Kirk
@grokys
Apr 25 2017 11:18
@kekekeks i think this could be a really useful test of our rendering
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:18
Do you want it in the main repo?
Steven Kirk
@grokys
Apr 25 2017 11:19
i'm interested to know if the problem is fixed with the deferred renderer
yeah, it might be good to have in the main repo!
only thing is solution load times
i'm worried if we keep adding samples then we'll be waiting an hour to load the sln
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:20
Right click -> Unload projects in folder
Steven Kirk
@grokys
Apr 25 2017 11:20
is there any way for projects to be unloaded by default on checkout i wonder?
Andrey Kunchev
@donandren
Apr 25 2017 11:21
i'm 99% of the time Unloaded all Android and iOS project, and this is remembered by visual studio
Steven Kirk
@grokys
Apr 25 2017 11:22
yeah, i'm just thinking of someone who clones the project from new
probably not a problem tbh
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:27
If anyone is interested, that's how it runs on WPF
There are also some differences in how we handle RenderTransform
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:37
Mkay, I've found the culpit
@grokys renderer sorts child visuals
And if they have the same ZIndex
The sorting algorithm that we are using
Will change the order of them
soerendd
@soerendd
Apr 25 2017 11:40
@kekekeks nice;)
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:40
BTW, @grokys why did you replaced an effective sorting method with list pooling
By LINQ
It's probably not a good idea to execute tons of linq queries on each render pass
OrderBy, however, should fix my issue, since it uses stable sorting algorithm
But it's still not effective from performance point of view
Steven Kirk
@grokys
Apr 25 2017 11:53
ah shit yeah i meant to put the old sorting method back
Nikita Tsukanov
@kekekeks
Apr 25 2017 11:57
We still shouldn't use List.Sort
I guess it's better to implement our own sorting for that purpose
Steven Kirk
@grokys
Apr 25 2017 12:12
yeah while i was moving stuff around i just used linq there meaning to come back to it and then forgot
Nikita Tsukanov
@kekekeks
Apr 25 2017 12:15
Mkay, got it working with proper ZIndex
And on .NET Core too
Johan Larsson
@JohanLarsson
Apr 25 2017 12:20
Nice!
Eric Winnington
@ewinnington
Apr 25 2017 12:39
@kekekeks That's awesome. :clap:
Nikita Tsukanov
@kekekeks
Apr 25 2017 12:41
Well, initially it was a demo that @hacklex and me came up with to show a student how to use WPF's templates
It turned out to be easy to port
Build seems to be working again
One of the tests is failing, however
Avalonia.Base.UnitTests.AvaloniaObjectTests_DataValidation.Setting_Validated_Direct_Property_Calls_UpdateDataValidation
And it was working for quite a while
Steven Kirk
@grokys
Apr 25 2017 16:57
ah yeah, i think that might be the test that fails every like 50 runs
it's a bit hard to debug
Nikita Tsukanov
@kekekeks
Apr 25 2017 16:58
Follow the second link, there is another set of tests failing there
Steven Kirk
@grokys
Apr 25 2017 16:58
arrgh i wish the tests tab worked on appveyor!
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:00
There are 11 tests failing in Avalonia.Visuals
Might be a result of changes merged from scenegraph
Steven Kirk
@grokys
Apr 25 2017 17:01
but they don't fail on travis right?
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:02
They don't even run on travis, I think
We've never managed to get this set of tests running on .NET Core
Steven Kirk
@grokys
Apr 25 2017 17:03
oh i thought VisualTests ran on travis
It seems that currently only Avalonia.Base.UnitTests run on .NET Core
BTW, it seems that recent SDK is capable of producing Mono-compatible build
Steven Kirk
@grokys
Apr 25 2017 17:04
RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, true);
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:05
Yep, latest argument controls if test set should run only on net461
Steven Kirk
@grokys
Apr 25 2017 17:05
ah
that's not good
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:05
We need to somehow make tests pass on .NET Core
I'm not sure why they are failing there
Wiesław Šoltés
@wieslawsoltes
Apr 25 2017 17:06
You can try enabling them
I did not run all of tests under travis when porting to new project system
but this was before recent merges
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:07
Is VS Community any faster than VS Enterprise? I've got enterprise license from bizspark, but I'm not sure that I should continue using it
Nikita Tsukanov
@kekekeks
Apr 25 2017 17:55
Disabling automatic package restore speeds up solution load dramatically
soerendd
@soerendd
Apr 25 2017 18:50
Am I right that when starting the ControlCatalog.NetCore it is using skia render backend? I ask because the transition in the carousel is not working. Known issue?
Nikita Tsukanov
@kekekeks
Apr 25 2017 18:59
SharpDX doesn't have .NET Core compatible build yet
So we are using Skia
Not sure why carousel transition is broken though
soerendd
@soerendd
Apr 25 2017 19:01
If i use ControlCatalog.Desktop an manually use UseSkia it breaks and tells me that libSkiaSharp.dll could not be found
Nikita Tsukanov
@kekekeks
Apr 25 2017 19:03
That's SkiaSharp's issue, it can't decide which binary version to use
Just manually copy libSkiaSharp from nuget package (win7-x86 version, the one for win10 is broken)
soerendd
@soerendd
Apr 25 2017 19:13
Ok now also ControlCatalog.Desktop works with skia and there is the same problem - transition is not working, jftr.
Steven Kirk
@grokys
Apr 25 2017 19:16
thanks @soerendd - will take a look into that
soerendd
@soerendd
Apr 25 2017 19:20
Shot into the blue: The crossfade animation works with opacity. I have checked that: opacity in general works. Maybe the rendering is too slow so that the next step is already in the pipeline? Maybe these information can help you
Nikita Tsukanov
@kekekeks
Apr 25 2017 19:22
If rendering was too slow, then scrolling would lag like hell
And it doesn't on that page
BTW, it seems that previewer is finally working
For both classic and new-style projects
You need to have desktop .NET alongside your other targets, though
I've also noticed that new project system is quite slow
According to profiler it takes ages to execute Reference::get_SourceProject
I had to manually resolve them using reflection and project paths
soerendd
@soerendd
Apr 25 2017 19:28
an other guess:) Could it be the same problem which was discussed earlier today? I mean the sort order of the renderer?
Nikita Tsukanov
@kekekeks
Apr 25 2017 19:29
It was fixed by switching to OrderBy
And transition seems to be broken for quite a long time
soerendd
@soerendd
Apr 25 2017 19:32
Last question (i try to learn how avalonia works currently). I saw that the image calls
grafik.png
the second parameter is the opacity
how is the opacity applied (if not during the render process)?
soerendd
@soerendd
Apr 25 2017 19:45
my final guess is that is seems to be related to the task executions which sets the opacity. Why? Because when setting a breakpoint with a condition ((opacity!=1)&&(opacity!=0)) in the Image.Render method is never breaks. Furthermore the animation is in case the debugger is connected and that breakpoint is active also not visible
Nikita Tsukanov
@kekekeks
Apr 25 2017 20:10
Opacity is applied via PushOpacity
Steven Kirk
@grokys
Apr 25 2017 20:15
yeah - looks like opacity is broken on skia - the pages of the ControlCatalog should fade too but they don't
oh no, as you say @soerendd it does work, but just not for crossfades. strange
Steven Kirk
@grokys
Apr 25 2017 20:20
ah - if you apply an opacity to a parent it doesn't get applied to the child
for example in the BorderPage.xaml:
      <Border Background="{StyleResource ThemeAccentBrush2}" 
              BorderBrush="{StyleResource ThemeAccentBrush}" 
              BorderThickness="4" 
              Padding="16" Opacity="0.1">
        <TextBlock>Border and Background</TextBlock>
      </Border>
blob
that explains it
soerendd
@soerendd
Apr 25 2017 20:22
The text in the second border should also be semi transparent, right?
Steven Kirk
@grokys
Apr 25 2017 20:23
yeah exactly
soerendd
@soerendd
Apr 25 2017 20:31
What I also noticed is that if you move the mouse over a button or any other control the whole window content is rendered. Are there plans to change that behavior?
danwalmsley
@danwalmsley
Apr 25 2017 20:37
@soerendd @grokys is currently re-writing the rendering stack to only render changes
but for now it renders entire window every frame
AvaloniaUI/Avalonia#827
soerendd
@soerendd
Apr 25 2017 20:42
@danwalmsley @grokys Nice, really nice. Can't wait for it😇
I ask this mainly because of my raspberry projects.
danwalmsley
@danwalmsley
Apr 25 2017 20:43
yeah it should make a huge difference to performance
have you run avalonia on one yet?
soerendd
@soerendd
Apr 25 2017 20:46
No. In a month or two I have some spare time. Then I will buy a third one and the official 7" display.
Currently I have one running Libreelec as media center. An other one drives two 4x20 chars LCD displays which shows what the media center is playing. I listen mostly to Internet radio these days or some playlists