These are chat archives for AvaloniaUI/Avalonia

28th
Oct 2017
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 08:48
Hi, I am currently evaluating Avalonia for one of my projects and as I plan to be cross platform right from the start, I tried creating an Avalonia application with VSmac, sadly I couldn't find any information on how to get started with Avalonia using VSmac. Is there any guide on how to do this?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:09
I just discovered that the templates in VS 2017 are for .netcoreapp1.1 - when will .netcoreapp2.0 be supported?
Matthijs ter Woord
@mterwoord
Oct 28 2017 09:10
it is already working on 2.0
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:12
@siegfriedpammer Unfortunately we don't support VS4Mac
You need to use VS2017
Regarding .NET Core 2.0
You can use our packages from nuget.org
The problem is that nuget itself is a bit broken
in terms of package dependency resolution
So you'll get tons of "detected package downgrade" errors
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:14
can/should I ignore these?
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:14
Probably
Matthijs ter Woord
@mterwoord
Oct 28 2017 09:14
yes, you can install extra packgaes and then the messages are gone
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:14
But they can be "fixed" by:
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Text.Encoding" Version="4.3.0"/>
<PackageReference Include="System.Threading.Tasks" Version="4.3.0"/>
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Text.Encoding" Version="4.3.0"/>
<PackageReference Include="System.Threading.Tasks" Version="4.3.0"/>
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Text.Encoding" Version="4.3.0"/>
<PackageReference Include="System.Threading.Tasks" Version="4.3.0"/>
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Text.Encoding" Version="4.3.0"/>
<PackageReference Include="System.Threading.Tasks" Version="4.3.0"/>
That will force nuget to install correct package versions
That is caused by nuget's stupid "nearest wins" policy
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:15
oh, I think I had these problems before...
when converting the ICSharpCode.Decompiler library to .netstandard...
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:15
Our nightly builds are targeting netstandard2.0/netcoreapp2.0 directly, so they don't have this problem
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:16
OK
another question, what is AvaloniaEdit?
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:17
Note that our VS extension doesn't support previewing xaml for netcoreapp profile, you need to use multitargeting with <TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks
AvaloniaEdit is a port of AvalonEdit
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:17
any architectural changes in AvaloniaEdit compared to AvalonEdit?
in terms of API
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:19
I think it's mostly compatible
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:20
OK... that's good to hear :)
is there an AvalonDock port as well?
Nikita Tsukanov
@kekekeks
Oct 28 2017 09:22
Nope
You can try to use DockNC
It's feature-incomplete, but works for AvalonStudio
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 09:24
hmmmm... looks promising... will check it out
thanks for your help!
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 10:18

when adding AvaloniaEdit-0.2.3-alpha I get

Exception thrown: 'System.IO.FileNotFoundException' in Avalonia.Markup.Xaml.dll
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Avalonia.Markup.Xaml.dll
Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

My XAML does not yet contain any reference to AvaloniaEdit... any thoughts?

Nikita Tsukanov
@kekekeks
Oct 28 2017 10:23
Install System.Xml.ReaderWriter from nuget, I guess
@danwalmsley what combination of avalonia and avaloniaedit versions are you currently using in AS?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 10:26
that fixed it, thanks... I thought these things should be handled by nuget dependencies... I guess I was wrong there...
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 10:57
What's the equivalent of BitmapImage in Avalonia?

also, how would I port

                <MenuItem Header="....">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="....png" />
                    </MenuItem.Icon>
                </MenuItem>

to Avalonia?

I found that MenuItem.Icon is of type object which is not very useful on its own...
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 11:03
also, I would be interested in contributing AvaloniaUI/Avalonia#224 how do I get started?
Nikita Tsukanov
@kekekeks
Oct 28 2017 11:11
use resm: convention in bindings
Also make sure that build action for your bitmap is EmbeddedResource
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 11:32
OK
thanks
is it possible to load images using pack uri or would I have to open the stream of the embedded resource and pass it to the Bitmap ctor?
Matthijs ter Woord
@mterwoord
Oct 28 2017 11:36
you are instantiatnig the bitmap in xaml or in code?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 11:36
I would need both ways in WPF/C# I would use new BitmapImage(new Uri("pack://,,,...."));

I assume

        static Bitmap LoadBitmap(string name)
        {
            var stream = typeof(Images).Assembly.GetManifestResourceStream(name + ".png");
            var image = new Bitmap(stream);
            return image;
        }

is one possibility...

Siegfried Pammer
@siegfriedpammer
Oct 28 2017 11:55
is there an alternative for ToolBar?
Nikita Tsukanov
@kekekeks
Oct 28 2017 11:57
@siegfriedpammer you can use ImageConverter for now, I guess
Or do it like this
I'm not sure if IAssetLoader is a stable API
So it's probably better to use GetManifestResourceStream directly

is there an alternative for ToolBar

I think people are implementing it manually using StackPanel

Siegfried Pammer
@siegfriedpammer
Oct 28 2017 11:59
OK
I think I will use GetManifestResourceStream for now...
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:33
hmm, at some point after 0.5.1, TextBlock has gotten a Padding property..
will there be a new release soonish?
Nikita Tsukanov
@kekekeks
Oct 28 2017 12:34
We are planning to get one in january
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:35
ok
hm, there's a daily feed..
lets see if that one works..
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:35
using the latest nightly build was throwing SharpDXExceptions everywhere...
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:36
sharpdx?
i'm targetting gtk3 and skia
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:36
OK... is that more stable?
not sure which backend I should pick...
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:40
not sure. what environment are you targetting?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:40
it's a desktop application that should run on win/linux/macos
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:41
i'm workign on an app targetting win (for dev) and beaglebone linux (arm)
for linux i'm using gtk3 and cairo
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:41
not sure how much extra work it would be to support different linux distros
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:41
?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:42
I mean they should all work as long as .netcore rt is supported, right?
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:42
pretty much
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:42
OK... then that should be fine
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:42
and the runtime stuff is compatible (ie fontconfig, skia, gtk)
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:43
I would be happy with getting it to work on win and macos
my application will make heavy use of TreeView and AvaloniaEdit
but I am far from getting it to compile...
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:44
start simple, like with a simple button etc
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 12:45
yeah, guess that's the only way... thanks for your help so far, guys!
I will not use DockNC for now... there's no official nuget package that works...
Matthijs ter Woord
@mterwoord
Oct 28 2017 12:47
hmm, that moment your pc pretty much runs out of ram... :(
Nikita Tsukanov
@kekekeks
Oct 28 2017 12:54

using the latest nightly build was throwing SharpDXExceptions everywhere...

Are you on Win7?

not sure how much extra work it would be to support different linux distros

Worry not. We are going to have out-of-the box solution based on https://github.com/qmfrederik/dotnet-packaging

Siegfried Pammer
@siegfriedpammer
Oct 28 2017 13:06
no Win10
Matthijs ter Woord
@mterwoord
Oct 28 2017 13:06
@siegfriedpammer you are on nightly build?
Siegfried Pammer
@siegfriedpammer
Oct 28 2017 13:07
no, I reverted back to 0.5.1
Nikita Tsukanov
@kekekeks
Oct 28 2017 13:11

no Win10

We need more info about those exceptions

Siegfried Pammer
@siegfriedpammer
Oct 28 2017 13:11
OK, will try to build repro
Matthijs ter Woord
@mterwoord
Oct 28 2017 13:12
even a full dump might help laready
Nikita Tsukanov
@kekekeks
Oct 28 2017 13:13
You can use sw-rendering by adding UseSkia after UsePlatformDetect
Matthijs ter Woord
@mterwoord
Oct 28 2017 13:22
skia backed wont use hardware acceleration?
Nikita Tsukanov
@kekekeks
Oct 28 2017 14:00
We haven't added opengl support yet
Jurjen Biewenga
@JurjenBiewenga
Oct 28 2017 17:42
Haven't had a lot of time lately but I've been tinkering with this silly project of mine where I have a custom Icloseable which starts windows in an async function however the windows are completely black
The xaml does work in the controlcatalog example
Here's the Icloseable and the xaml https://hastebin.com/xulofupeka.http
Nikita Tsukanov
@kekekeks
Oct 28 2017 17:54
We need to add an overload for Run method that would accept CancellationToken or something
Jurjen Biewenga
@JurjenBiewenga
Oct 28 2017 21:05
Any ideas why it might not be rendering properly?
Nikita Tsukanov
@kekekeks
Oct 28 2017 21:15
Probably misconfigured appbuilder, blocked main loop or something like that
Jurjen Biewenga
@JurjenBiewenga
Oct 28 2017 21:17
Any good way to debug that?
That's what I'm running in a separate thread
Nikita Tsukanov
@kekekeks
Oct 28 2017 21:19
It won't work with separate threads
You can only have UI on one
Jurjen Biewenga
@JurjenBiewenga
Oct 28 2017 21:33
Everything from avalonia is on the same thread, I'm not calling avalonia functions from a different one. Would that still not work?
Nikita Tsukanov
@kekekeks
Oct 28 2017 21:34
yes, that should work
Jurjen Biewenga
@JurjenBiewenga
Oct 28 2017 21:37
Not sure what's going wrong then